summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/dcl.decl/dcl.meaning
Commit message (Collapse)AuthorAgeFilesLines
* PR33503: When a qualified name in a redeclaration names a prior declaration inRichard Smith2018-01-031-0/+21
| | | | | | | | | | | an inline namespace, update its semantic DeclContext to match. We would previously get the semantic DeclContext wrong (pointing to the named scope rather than the inline namespace within it), resulting in wrong lookup results and linkage-related problems if the inline namespace was an anonymous namespace. llvm-svn: 321770
* Do not inherit default arguments for friend function in class template.Serge Pavlov2017-06-081-0/+33
| | | | | | | | | | | | | | | | | | | A function declared in a friend declaration may have declarations prior to the containing class definition. If such declaration defines default argument, the friend function declaration inherits them. This behavior causes problems if the class where the friend is declared is a template: during the class instantiation the friend function looks like if it had default arguments, so error is triggered. With this change friend functions declared in class templates do not inherit default arguments. Actual set of them will be defined at the point where the containing class is instantiated. This change fixes PR12724. Differential Revision: https://reviews.llvm.org/D30393 llvm-svn: 304965
* P0012R1: Make exception specifications be part of the type system. ThisRichard Smith2016-10-161-0/+14
| | | | | | | implements the bulk of the change (modifying the type system to include exception specifications), but not all the details just yet. llvm-svn: 284337
* [modules] Prefer more complete array types.Vassil Vassilev2016-02-281-0/+4
| | | | | | | | | | | | | | If we import a module that has a complete array type and one that has an incomplete array type, the declaration found by name lookup might be the one with the incomplete type, possibly resulting in rejects-valid. Now, the name lookup prefers decls with a complete array types. Also, diagnose cases when the redecl chain has array bound, different from the merge candidate. Reviewed by Richard Smith. llvm-svn: 262189
* [Sema] Emit a better diagnostic when variable redeclarations disagreeDavid Majnemer2015-07-141-1/+1
| | | | | | | | | | | We referred to all declaration in definitions in our diagnostic messages which is can be inaccurate. Instead, classify the declaration and emit an appropriate diagnostic for the new declaration and an appropriate note pointing to the old one. This fixes PR24116. llvm-svn: 242190
* [Sema] Diagnose default argument on a parameter pack.Benjamin Kramer2015-03-271-0/+3
| | | | | | | | This is ill-formed (and cannot be used anyways). PR23028. llvm-svn: 233376
* FIX PR 18432, default args, friends & late-parsed members.Nathan Sidwell2015-02-191-0/+19
| | | | | | | | | | | | Sema::MergeCXXFunctionDecl: propagate hasUnparsedDefaultArg to new decl. Parser::HandleMemberFunctionDeclDelays: check hasUnparsedDefaultArg flag. Parser::ParseLexedMethodDeclaration: handle inherited unparsed default arg case. llvm-svn: 229852
* Code cleanupNathan Sidwell2015-01-301-0/+1
| | | | | | | Parser::ParseLexedMethodDeclaration: Use local var for Param Sema::MergeCXXFunctionDecls: Use hasInheritedDefaultArg llvm-svn: 227577
* Don't crash on an invalid trailing return type on a function before a '...'Nico Weber2014-12-301-0/+4
| | | | | | | | | | | | clang tries to produce a helpful diagnostic for the traiilng '...', but the code that r216778 added for this doesn't expect an invalid trailing return type. Add code to explicitly handle this. Having explicit code for this but not for other things looks a bit strange, but trailing return types are special in that they have a separate existence bit in addition to the type (see r158348). llvm-svn: 224974
* Parse: Recover more gracefully from extra :: tokens before a {David Majnemer2014-12-291-0/+2
| | | | | | | Instead of crashing, recover by eating the extra trailing scope qualifier. This means we will treat 'struct A:: {' as 'struct A {'. llvm-svn: 224966
* Parse: Ignore '::' in 'struct :: {'David Majnemer2014-12-291-1/+0
| | | | | | | Let's pretend that we didn't see the '::' instead of go on believing that we've got some anonymous, but globally qualified, struct. llvm-svn: 224945
* Sema: Don't crash when solitary :: token appears before { in struct defDavid Majnemer2014-12-291-0/+3
| | | | | | | | hasDeclaratorForAnonDecl, getDeclaratorForAnonDecl and getTypedefNameForAnonDecl are expected to handle the case where NamedDeclOrQualifier holds the wrong type or nothing at all. llvm-svn: 224912
* Fix for PR20660, where unexpanded parameter pack in function parameter ↵Larisse Voufo2014-08-291-0/+27
| | | | | | clause causes clang to crash. llvm-svn: 216778
* Reject varargs '...' in function prototype if there are more parameters afterRichard Smith2014-08-111-2/+1
| | | | | | | | | | | it. Diagnose with recovery if it appears after a function parameter that was obviously supposed to be a parameter pack. Otherwise, warn if it immediately follows a function parameter pack, because the user most likely didn't intend to write a parameter pack followed by a C-style varargs ellipsis. This warning can be syntactically disabled by using ", ..." instead of "...". llvm-svn: 215408
* PR19742: cv-qualifiers and ref-qualifiers aren't allowed on functions withinRichard Smith2014-05-142-4/+24
| | | | | | | pointer and reference types, even if those types are produced by template instantiation. llvm-svn: 208825
* Don't emit an ExtWarn on declarations of variable template specializations;Richard Smith2014-04-171-4/+4
| | | | | | | we'll already have issued the relevant diagnostic when we saw the declaration of the primary template. llvm-svn: 206441
* Don't fold together the name lookup entries for two declarations if they areRichard Smith2014-03-171-11/+12
| | | | | | declared in different namespaces in the same inline namespace set. llvm-svn: 204082
* Replace "can not" with "cannot" in diagnostics messages.Ismail Pazarbasi2014-03-071-3/+3
| | | | llvm-svn: 203302
* PR13110: Add a -Wignored-qualifiers warning when ignoring a const, volatile, orRichard Smith2014-02-191-3/+2
| | | | | | _Atomic qualifier applied to a reference type. llvm-svn: 201620
* Implement DR482: namespace members can be redeclared with a qualified nameRichard Smith2013-12-051-5/+13
| | | | | | | | | | within their namespace, and such a redeclaration isn't required to be a definition any more. Update DR status page to say Clang 3.4 instead of SVN and add new Clang 3.5 category (but keep Clang 3.4 yellow for now). llvm-svn: 196481
* Correct hyphenations in comments and assert messagesAlp Toker2013-12-051-1/+1
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities in nearby lines. llvm-svn: 196466
* Per [dcl.meaning]p1, a name in an inline namespace can be redeclared using aRichard Smith2013-12-051-0/+79
| | | | | | | name from the enclosing namespace set if the name is specified as a qualified-id. llvm-svn: 196464
* Teach typo correction to look inside of classes like it does namespaces.Kaelyn Uhrain2013-09-261-3/+3
| | | | | | | | | | | | | | | Unlike with namespaces, searching inside of classes requires also checking the access to correction candidates (i.e. don't suggest a correction to a private class member for a correction occurring outside that class and its methods or friends). Included is a small (one line) fix for a bug, that was uncovered while cleaning up the unit tests, where the decls from a TypoCorrection candidate were preserved in new TypoCorrection candidates that are derived (copied) from the old TypoCorrection--notably when creating a new candidate by changing the NestedNameSpecifier associated with the base idenitifer. llvm-svn: 191449
* Switch the semantic DeclContext for a block-scope declaration of a function orRichard Smith2013-09-201-4/+61
| | | | | | | | | | | | | | variable from being the function to being the enclosing namespace scope (in C++) or the TU (in C). This allows us to fix a selection of related issues where we would build incorrect redeclaration chains for such declarations, and fail to notice type mismatches. Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern, which is only found when searching scopes, and not found when searching DeclContexts. Such a declaration is only made visible in its DeclContext if there are no non-LocalExtern declarations. llvm-svn: 191064
* Mark that qualifiers can prefix the auto type. This seems to just haveChandler Carruth2013-09-021-1/+1
| | | | | | | | | | | | | | | | | | been an oversight, as it definitely works. Every test which changed had the const written on the LHS of the auto already. Notably, this also makes things like cpp11-migrate's formation of 'const auto &' variables much more familiar. Yes, many people feel that 'const' and other qualifiers belong on the RHS of the type. I'm not going to argue about that because Clang already *overwhelming* places the qualifiers on the LHS when it can and on the RHS when it must. We shouldn't diverge for auto. We should add a tool to clang-tidy that fixes this in either direction, and then wire up clang-tidy to tools like cpp11-migrate to fix their placement after transforms. llvm-svn: 189769
* Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:Richard Smith2013-08-131-0/+152
| | | | | | | | | | | | | When a local extern declaration redeclares some other entity, the type of that entity is merged with the prior type if the prior declaration is visible (in C) or is declared in the same scope (in C++). - Make LookupRedeclarationWithLinkage actually work in C++, use it in the right set of cases, and make it track whether it found a shadowed declaration. - Track whether we found a declaration in the same scope (for C++) including across serialization and template instantiation. llvm-svn: 188307
* PR15390: If a function returns a pointer to a function, that function typeRichard Smith2013-03-061-1/+4
| | | | | | | can't have default arguments even though it's a parameter-declaration-clause in a function declaration. llvm-svn: 176542
* Fixed an assertion failure triggered by invalid code.Enea Zaffanella2013-01-111-4/+2
| | | | | | | | Set invalid type of declarator after emitting error diagnostics, so that it won't be later considered when instantiating the template. Added test5_inst in test/SemaCXX/condition.cpp for non-regression. llvm-svn: 172201
* Properly compute triviality for explicitly-defaulted or deleted special members.Richard Smith2012-12-081-2/+2
| | | | | | | | | | | | | | Remove pre-standard restriction on explicitly-defaulted copy constructors with 'incorrect' parameter types, and instead just make those special members non-trivial as the standard requires. This required making CXXRecordDecl correctly handle classes which have both a trivial and a non-trivial special member of the same kind. This also fixes PR13217 by reimplementing DiagnoseNontrivial in terms of the new triviality computation technology. llvm-svn: 169667
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-193-0/+3
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* Fix directive parsing in VerifyDiagnosticConsumer so that it ensures that ↵Andy Gibbs2012-10-191-3/+3
| | | | | | | | "expected" is at the start of the word and will no longer accept typos such as "junkexpected-*" as a valid "expected-*" directive. A very few test-cases had to be amended to adhere to the new rule. Patch reviewed by David Blaikie. llvm-svn: 166279
* Promote the warning about extra qualification on a declaration from aDouglas Gregor2012-09-131-7/+7
| | | | | | | | warning to an error. C++ bans it, and both GCC and EDG diagnose it as an error. Microsoft allows it, so we still warn in Microsoft mode. Fixes <rdar://problem/11135644>. llvm-svn: 163831
* Final piece of core issue 1330: delay computing the exception specification ofRichard Smith2012-07-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a defaulted special member function until the exception specification is needed (using the same criteria used for the delayed instantiation of exception specifications for function temploids). EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to resolve the exception specification. This is enabled for all C++ modes: it's a little faster in the case where the exception specification isn't used, allows our C++11-in-C++98 extensions to work, and is still correct for C++98, since in that mode the computation of the exception specification can't fail. The diagnostics here aren't great (in particular, we should include implicit evaluation of exception specifications for defaulted special members in the template instantiation backtraces), but they're not much worse than before. Our approach to the problem of cycles between in-class initializers and the exception specification for a defaulted default constructor is modified a little by this change -- we now reject any odr-use of a defaulted default constructor if that constructor uses an in-class initializer and the use is in an in-class initialzer which is declared lexically earlier. This is a closer approximation to the current draft solution in core issue 1351, but isn't an exact match (but the current draft wording isn't reasonable, so that's to be expected). llvm-svn: 160847
* If parsing a trailing-return-type fails, don't pretend we didn't have one atRichard Smith2012-06-121-1/+1
| | | | | | all. Suppresses follow-on errors mentioned in PR13074. llvm-svn: 158348
* Test file I forgot to 'svn add' in r156802.Richard Smith2012-05-151-0/+14
| | | | llvm-svn: 156805
* Fold the six functions checking explicitly-defaulted special member functionsRichard Smith2012-05-151-7/+20
| | | | | | | | | | | | into one. These were all performing almost identical checks, with different bugs in each of them. This fixes PR12806 (we weren't setting the exception specification for an explicitly-defaulted, non-user-provided default constructor) and enforces 8.4.2/2's rule that an in-class defaulted member must exactly match the implicit parameter type. llvm-svn: 156802
* Push the knowledge that we are parsing a type-id/type-name further into theRichard Smith2012-05-091-1/+5
| | | | | | | parser, and use it to emit better diagnostics in cases where an identifer can't be looked up as a type name. llvm-svn: 156508
* Unify and fix our checking of C++ [dcl.meaning]p1's requirementsDouglas Gregor2012-03-281-0/+15
| | | | | | | | | concerning qualified declarator-ids. We now diagnose extraneous qualification at namespace scope (which we had previously missed) and diagnose these qualification errors for all kinds of declarations; it was rather uneven before. Fixes <rdar://problem/11135644>. llvm-svn: 153577
* Diagnose tag and class template declarations with qualifiedDouglas Gregor2012-03-171-0/+22
| | | | | | declarator-ids that occur at class scope. Fixes PR8019. llvm-svn: 153002
* Fix parsing of trailing-return-type. Types are syntactically prohibited fromRichard Smith2012-03-121-1/+1
| | | | | | | | being defined here: [] () -> struct S {} does not define struct S. In passing, implement DR1318 (syntactic disambiguation of 'final'). llvm-svn: 152551
* PR11684, core issue 1417:Richard Smith2012-02-102-12/+43
| | | | | | | | | | | | | | o Correct the handling of the restrictions on usage of cv-qualified and ref-qualified function types. o Fix a bug where such types were rejected in template type parameter default arguments, due to such arguments not being treated as a template type arg context. o Remove the ExtWarn for usage of such types as template arguments; that was a standard defect, not a GCC extension. o Improve the wording and unify the code for diagnosing cv-qualifiers with the code for diagnosing ref-qualifiers. llvm-svn: 150244
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Move & comment the 'decltype in declarator-id' as suggested by Doug Gregor.David Blaikie2011-12-141-4/+2
| | | | llvm-svn: 146576
* Disallow decltype in qualified declarator-ids.David Blaikie2011-12-131-0/+26
| | | | llvm-svn: 146480
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-139-9/+9
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* constexpr functions are implicitly const. More tests to follow.Richard Smith2011-09-301-2/+2
| | | | llvm-svn: 140831
* Add test case for defaulted copy and move structure validation.Sebastian Redl2011-09-041-0/+62
| | | | | | | | Fix bug this uncovered. Address minor comments from Doug. Enable cxx_implicit_moves feature. llvm-svn: 139101
* Fix an inconsistency in Sema::ConvertArgumentsForCall in thatPeter Collingbourne2011-07-292-2/+2
| | | | | | | the callee note diagnostic was not emitted in the case where there were too few arguments. llvm-svn: 136437
* Add -fcxx-exceptions to all tests that use C++ exceptions.Anders Carlsson2011-02-281-1/+1
| | | | llvm-svn: 126599
* Fix a few auto-related issues:Richard Smith2011-02-223-0/+11
| | | | | | | | | | | | | | | * 'auto' was being rejected on abstract-declarators with trailing return types and on typedefs with trailing return types. 'auto' is always allowed in these cases. This was found while testing the fix for PR 9278. * A very poor diagnostic was being issued for auto (f() -> int): "return type must be 'auto', not 'auto'". This is closely related to PR 9060. * Trailing return type handling was happening slightly too late, resulting in the checks for functions returning arrays and functions returning functions being missed. llvm-svn: 126166
OpenPOWER on IntegriCloud