summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl
Commit message (Collapse)AuthorAgeFilesLines
* When diagnosing an ambiguity, only note the candidates that contributeRichard Smith2019-10-241-11/+11
| | | | to the ambiguity, rather than noting all viable candidates.
* [CXX] Exercise all paths through these tests.Paul Robinson2019-07-091-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D63894 llvm-svn: 365555
* PR31606: Generalize our tentative DR resolution for inheriting copy/moveRichard Smith2017-01-131-14/+14
| | | | | | constructors to better match the pre-P0136R1 behavior. llvm-svn: 291955
* PR30305: Implement proposed DR resolution to prevent slicing via inherited ↵Richard Smith2017-01-081-3/+27
| | | | | | | | | | | | constructor. The rule we use is that a construction of a class type T from an argument of type U cannot use an inherited constructor if U is the same as T or is derived from T (or if the initialization would first convert it to such a type). This (approximately) matches the rule in use by GCC, and matches the current proposed DR resolution. llvm-svn: 291403
* Fix name hiding and redeclaration checking for dependent localRichard Smith2016-12-181-20/+19
| | | | | | using-declarations. llvm-svn: 290072
* Fix some interactions between C++11 and C++14 features and using-declarations:Richard Smith2016-12-181-4/+154
| | | | | | | | | | | * a dependent non-type using-declaration within a function template can be valid, as it can refer to an enumerator, so don't reject it in the template definition * we can partially substitute into a dependent using-declaration if it appears within a (local class in a) generic lambda within a function template, which means an UnresolvedUsing*Decl doesn't necessarily instantiate to a UsingDecl. llvm-svn: 290071
* P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:Richard Smith2016-06-283-1/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace inheriting constructors implementation with new approach, voted into C++ last year as a DR against C++11. Instead of synthesizing a set of derived class constructors for each inherited base class constructor, we make the constructors of the base class visible to constructor lookup in the derived class, using the normal rules for using-declarations. For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived class that tracks the requisite additional information. We create shadow constructors (not found by name lookup) in the derived class to model the actual initialization, and have a new expression node, CXXInheritedCtorInitExpr, to model the initialization of a base class from such a constructor. (This initialization is special because it performs real perfect forwarding of arguments.) In cases where argument forwarding is not possible (for inalloca calls, variadic calls, and calls with callee parameter cleanup), the shadow inheriting constructor is not emitted and instead we directly emit the initialization code into the caller of the inherited constructor. Note that this new model is not perfectly compatible with the old model in some corner cases. In particular: * if B inherits a private constructor from A, and C uses that constructor to construct a B, then we previously required that A befriends B and B befriends C, but the new rules require A to befriend C directly, and * if a derived class has its own constructors (and so its implicit default constructor is suppressed), it may still inherit a default constructor from a base class llvm-svn: 274049
* Add support for derived class special members hiding functions brought in fromRichard Smith2016-05-131-0/+32
| | | | | | | | | a base class via a using-declaration. If a class has a using-declaration declaring either a constructor or an assignment operator, eagerly declare its special members in case they need to displace a shadow declaration from a using-declaration. llvm-svn: 269398
* Add forgotten test from r268594.Richard Smith2016-05-051-0/+4
| | | | llvm-svn: 268665
* Add a FixItHint for the new diagnostic for a non-class-scope ↵Richard Smith2016-05-051-0/+27
| | | | | | using-declaration that names a class-scope enumerator. llvm-svn: 268664
* Fix implementation of C++'s restrictions on using-declarations referring to ↵Richard Smith2016-05-053-48/+83
| | | | | | | | | | | enumerators: * an unscoped enumerator whose enumeration is a class member is itself a class member, so can only be the subject of a class-scope using-declaration. * a scoped enumerator cannot be the subject of a class-scope using-declaration. llvm-svn: 268594
* [Lit Test] Updated 34 Lit tests to be C++11 compatible.Charles Li2015-11-171-1/+6
| | | | | | | Added expected diagnostics new to C++11. Expanded RUN line to: default, C++98/03 and C++11. llvm-svn: 253371
* Sema: Don't dyn_cast a null pointer in CheckUsingDeclQualifierDavid Majnemer2014-12-171-0/+5
| | | | | | | | | This code was written with the intent that a pointer could be null but we dyn_cast'd it anyway. Change the dyn_cast to a dyn_cast_or_null. This fixes PR21933. llvm-svn: 224411
* If a using-declaration names a class member, but appears outside a class, tryRichard Smith2014-04-021-1/+95
| | | | | | to suggest a different syntax to get the same effect. llvm-svn: 205467
* Replace "can not" with "cannot" in diagnostics messages.Ismail Pazarbasi2014-03-073-7/+7
| | | | llvm-svn: 203302
* Merge using-decl-pr17575.cpp into existing test case.Peter Collingbourne2014-03-051-0/+6
| | | | llvm-svn: 202925
* DR101, PR12770: If a function is declared in the same context as aRichard Smith2014-02-061-7/+19
| | | | | | | | using-declaration, and they declare the same function (either because the using-declaration is in the same namespace as the declaration it imports, or because they're both extern "C"), they do not conflict. llvm-svn: 200897
* Unresolved lookups can have using declarations that refer toDouglas Gregor2013-01-301-0/+9
| | | | | | unresolved using declarations. Fixes PR14768 / <rdar://problem/13030296>. llvm-svn: 173883
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-192-0/+2
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* Fix PR10447: lazily building name lookup tables for DeclContexts was broken.Richard Smith2012-03-131-6/+4
| | | | | | | | | | | | | | | | | | | | | | | The deferred lookup table building step couldn't accurately tell which Decls should be included in the lookup table, and consequently built different tables in some cases. Fix this by removing lazy building of DeclContext name lookup tables. In practice, the laziness was frequently not worthwhile in C++, because we performed lookup into most DeclContexts. In C, it had a bit more value, since there is no qualified lookup. In the place of lazy lookup table building, we simply don't build lookup tables for function DeclContexts at all. Such name lookup tables are not useful, since they don't capture the scoping information required to correctly perform name lookup in a function scope. The resulting performance delta is within the noise on my testing, but appears to be a very slight win for C++ and a very slight loss for C. The C performance can probably be recovered (if it is a measurable problem) by avoiding building the lookup table for the translation unit. llvm-svn: 152608
* Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:Richard Smith2012-01-121-8/+8
| | | | | | | | | | | | | | | | | | | | | | | - If the declarator is at the start of a line, and the previous line contained another declarator and ended with a comma, then that comma was probably a typo for a semicolon: int n = 0, m = 1, l = 2, // k = 5; myImportantFunctionCall(); // oops! - If removing the parentheses would correctly initialize the object, then produce a note suggesting that fix. - Otherwise, if there is a simple initializer we can suggest which performs value-initialization, then provide a note suggesting a correction to that initializer. Sema::Declarator now tracks the location of the comma prior to the declarator in the declaration, if there is one, to facilitate providing the note. The code to determine an appropriate initializer from the -Wuninitialized warning has been factored out to allow use in both that and -Wvexing-parse. llvm-svn: 148072
* David Blaikie and Chandler would like us to diagnoseRichard Smith2012-01-061-6/+6
| | | | | | | | int f(); in function scopes under -Wvexing-parse, so now we do. llvm-svn: 147649
* Tweak to r147599 for PR10828: Move the check from the parser into sema, and useRichard Smith2012-01-061-6/+6
| | | | | | | the Semantic Powers to only warn on class types (or dependent types), where the constructor or destructor could do something interesting. llvm-svn: 147642
* PR10828: Produce a warning when a no-arguments function is declared in blockRichard Smith2012-01-051-7/+6
| | | | | | | | | | | | | | | | | scope, when no other indication is provided that the user intended to declare a function rather than a variable. Remove some false positives from the existing 'parentheses disambiguated as a function' warning by suppressing it when the declaration is marked as 'typedef' or 'extern'. Add a new warning group -Wvexing-parse containing both of these warnings. The new warning is enabled by default; despite a number of false positives (and one bug) in clang's test-suite, I have only found genuine bugs with it when running it over a significant quantity of real C++ code. llvm-svn: 147599
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message are compared. If either is a substring of the other, then no error is given. This gives rise to an unexpected case: // expect-error{{candidate function has different number of parameters}} will match the following error messages from Clang: candidate function has different number of parameters (expected 1 but has 2) candidate function has different number of parameters It will also match these other error messages: candidate function function has different number of parameters number of parameters This patch will change so that the verification string must be a substring of the diagnostic message before accepting. Also, all the failing tests from this change have been corrected. Some stats from this cleanup: 87 - removed extra spaces around verification strings 70 - wording updates to diagnostics 40 - extra leading or trailing characters (typos, unmatched parens or quotes) 35 - diagnostic level was included (error:, warning:, or note:) 18 - flag name put in the warning (-Wprotocol) llvm-svn: 146619
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-131-1/+1
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* Implement access checking for the "delete" operator. Fixes PR9050,Douglas Gregor2011-02-011-0/+1
| | | | | | from Alex Miller! llvm-svn: 124663
* Revert r120063, it was wrong.John McCall2010-11-291-12/+3
| | | | llvm-svn: 120296
* Redeclarations of using declarations are not okay in function scopes.John McCall2010-11-231-3/+12
| | | | | | | | Not sure what I was thinking before. Fixes PR8668. llvm-svn: 120063
* If name lookup finds different type declarations in different scopesDouglas Gregor2010-08-111-0/+1
| | | | | | | | that actually refer to the same underlying type, it is not an ambiguity; add uniquing support based on the canonical type of type declarations. Fixes <rdar://problem/8296180>. llvm-svn: 110806
* A using declaration can redeclare a typedef to the same type. TheseDouglas Gregor2010-07-071-0/+13
| | | | | | | | typedefs won't have the same canonical declaration (since they are distinct), so we need to check for this case specifically. Fixes <rdar://problem/8018262>. llvm-svn: 107833
* tests: Use %clangxx when using driver for C++, in case C++ support is disabled.Daniel Dunbar2010-06-291-1/+1
| | | | llvm-svn: 107153
* Fix a point of semantics with using declaration hiding: method templatesJohn McCall2010-06-161-8/+27
| | | | | | | | | | | | | | | | | introduced by using decls are hidden even if their template parameter lists or return types differ from the "overriding" declaration. Propagate using shadow declarations around more effectively when looking up template-ids. Reperform lookup for template-ids in member expressions so that access control is properly set up. Fix some number of latent bugs involving template-ids with totally invalid base types. You can only actually get these with a scope specifier, since otherwise the template-id won't parse as a template-id. Fixes PR7384. llvm-svn: 106093
* It turns out that we should be allowing redeclarations within functionDouglas Gregor2010-05-061-0/+15
| | | | | | scope. Thanks to Steven Watanabe for correcting me. llvm-svn: 103210
* Change the 'declared at' diagnostic to say 'declared here'.Anders Carlsson2010-04-231-1/+1
| | | | llvm-svn: 102163
* Record nested-name-specifiers of when we createDouglas Gregor2010-04-221-1/+1
| | | | | | elaborated-type-specifiers. Patch by Enea Zaffanella! llvm-svn: 102065
* Whenever we complain about a failed initialization of a function orDouglas Gregor2010-04-221-1/+2
| | | | | | | | | | | | | | | | | method parameter, provide a note pointing at the parameter itself so the user does not have to manually look for the function/method being called and match up parameters to arguments. For example, we now get: t.c:4:5: warning: incompatible pointer types passing 'long *' to parameter of type 'int *' [-pedantic] f(long_ptr); ^~~~~~~~ t.c:1:13: note: passing argument to parameter 'x' here void f(int *x); ^ llvm-svn: 102038
* Turn access control on by default in -cc1.John McCall2010-04-091-1/+1
| | | | | | | | Remove -faccess-control from -cc1; add -fno-access-control. Make the driver pass -fno-access-control by default. Update a bunch of tests to be correct under access control. llvm-svn: 100880
* Regularize support for naming conversion functions in using decls.John McCall2010-03-311-1/+42
| | | | llvm-svn: 99979
* When parsing an identifier as an expression in C++, only try to annotate itJohn McCall2010-01-071-2/+3
| | | | | | | | | | as a type or scope token if the next token requires it. This eliminates a lot of redundant lookups in C++, but there's room for improvement; a better solution would do a single lookup whose kind and results would be passed through the parser. llvm-svn: 92930
* Update tests to use %clang instead of 'clang', and forcibly disable use of 'Daniel Dunbar2009-12-151-1/+1
| | | | | | | clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to garbage). llvm-svn: 91460
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-1510-10/+10
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Test member template using hiding.John McCall2009-12-111-2/+45
| | | | llvm-svn: 91099
* Check if the target of a using decl is already declared in this scope beforeJohn McCall2009-12-111-0/+14
| | | | | | | doing any of the other redeclaration checks. We were missing a few cases. Fixes PR 5752. llvm-svn: 91096
* Actually try to trigger the last diagnostic in the declaration-collision ↵John McCall2009-12-101-4/+9
| | | | | | | | | test case. Surprisingly, we *do* diagnose one of them. Since we don't really track scopes into instantiation, this has to signal some kind of bug. llvm-svn: 91063
* Improve the diagnostic when a new declaration conflicts with a using shadowJohn McCall2009-12-101-0/+89
| | | | | | | | declaration. Rename note_using_decl to note_using, which is possibly less confusing. Add a test for non-class-scope using decl collisions and be sure to note the case we can't diagnose yet. llvm-svn: 91057
* Implement redeclaration checking and hiding semantics for using ↵John McCall2009-12-103-0/+190
| | | | | | | | | | | declarations. There are a couple of O(n^2) operations in this, some analogous to the usual O(n^2) redeclaration problem and some not. In particular, retroactively removing shadow declarations when they're hidden by later decls is pretty unfortunate. I'm not yet convinced it's worse than the alternative, though. llvm-svn: 91045
* Handle unresolved using decls in bare lookups. These are not being adequatelyJohn McCall2009-12-081-0/+13
| | | | | | tested. Fixes PR5727. llvm-svn: 90893
* Correctly implement the C++03 and 0x restrictions on class-member usingJohn McCall2009-12-082-5/+60
| | | | | | declarations. llvm-svn: 90843
* Fix "using typename" and the instantiation of non-dependent using declarations.John McCall2009-12-041-0/+183
| | | | llvm-svn: 90614
OpenPOWER on IntegriCloud