summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/dcl.decl
Commit message (Collapse)AuthorAgeFilesLines
...
* Improve the error message when a function overload candidate is rejectedKaelyn Uhrain2012-06-191-1/+1
| | | | | | | | | | | | | | | | | because it expects a reference and receives a non-l-value. For example, given: int foo(int &); template<int x> void b() { foo(x); } clang will now print "expects an l-value for 1st argument" instead of "no known conversion from 'int' to 'int &' for 1st argument". The change in wording (and associated code to detect the case) was prompted by comment #5 in PR3104, and should be the last bit of work needed for the bug. llvm-svn: 158691
* Add missing narrowing check: converting from a signed integral type to a widerRichard Smith2012-06-131-0/+14
| | | | | | unsigned type is narrowing if the source is non-constant or negative. llvm-svn: 158377
* 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-153-9/+80
| | | | | | | | | | | | 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
* Dependent-sequence initialization of a single element can be directDouglas Gregor2012-04-041-1/+13
| | | | | | list-initialization. Loosen an over-eager assertion to fix PR12453. llvm-svn: 153995
* PR10217: Provide diagnostics explaining why an implicitly-deleted specialRichard Smith2012-03-301-2/+2
| | | | | | member function is deleted. llvm-svn: 153773
* 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
* Fix parsing of type-specifier-seq's. Types are syntactically allowed to beRichard Smith2012-03-121-1/+5
| | | | | | | | | | | | | | | | | | defined here, but not semantically, so new struct S {}; is always ill-formed, even if there is a struct S in scope. We also had a couple of bugs in ParseOptionalTypeSpecifier caused by it being under-loved (due to it only being used in a few places) so merge it into ParseDeclarationSpecifiers with a new DeclSpecContext. To avoid regressing, this required improving ParseDeclarationSpecifiers' diagnostics in some cases. This also required teaching ParseSpecifierQualifierList about constexpr... which incidentally fixes an issue where we'd allow the constexpr specifier in other bad places. llvm-svn: 152549
* Special members which are defaulted or deleted on their first declaration areRichard Smith2012-02-261-1/+2
| | | | | | | | | | | | | trivial if the implicit declaration would be. Don't forget to set the Trivial flag on the special member as well as on the class. It doesn't seem ideal that we have two separate mechanisms for storing this information, but this patch does not attempt to address that. This leaves us in an interesting position where the has_trivial_X trait for a class says 'yes' for a deleted but trivial X, but is_trivially_Xable says 'no'. This seems to be what the standard requires. llvm-svn: 151465
* When overload resolution picks an implicitly-deleted special memberDouglas Gregor2012-02-151-2/+2
| | | | | | | | | function, provide a specialized diagnostic that indicates the kind of special member function (default constructor, copy assignment operator, etc.) and that it was implicitly deleted. Add a hook where we can provide more detailed information later. llvm-svn: 150611
* 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
* Add -Wnarrowing as an alias for -Wc++11-narrowing, for better GCCDouglas Gregor2012-01-231-0/+1
| | | | | | compatibility. llvm-svn: 148702
* Downgrade C++11 narrowing conversion errors to warnings default-mappedDouglas Gregor2012-01-232-0/+223
| | | | | | | | | to an error, so that users can turn them off if necessary. Note that this does *not* change the behavior of in a SFINAE context, where we still flag an error even if the warning is disabled. This matches GCC's behavior. llvm-svn: 148701
* Move narrowing conversion detection code from SemaInit to SemaOverload, readyRichard Smith2012-01-181-3/+23
| | | | | | | | | | | | | for it to be used in converted constant expression checking, and fix a couple of issues: - Conversion operators implicitly invoked prior to the narrowing conversion were not being correctly handled when determining whether a constant value was narrowed. - For conversions from floating-point to integral types, the diagnostic text incorrectly always claimed that the source expression was not a constant expression. llvm-svn: 148381
* constexpr: initialization of a union from an empty initializer-list shouldRichard Smith2012-01-121-0/+12
| | | | | | | | | zero-initialize the first union member. Also fix a bug where initializing an array of types compatible with wchar_t from a wide string literal failed in C, and fortify the C++ tests in this area. This part can't be tested without a code change to enable array evaluation in C (where an existing test fails). llvm-svn: 148035
* List-initialization via constructor part 1. Still needs: pretty-printing, ↵Sebastian Redl2011-12-221-17/+17
| | | | | | overloading, initializer_list. llvm-svn: 147145
* PR11614: Mark defaulted special constructors as constexpr if their implicitRichard Smith2011-12-221-0/+55
| | | | | | definition would satisfy the constexpr requirements. llvm-svn: 147128
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-152-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* When we notice that a member function is defined with "= delete" or "=Douglas Gregor2011-11-071-0/+12
| | | | | | | | | | | | default", make a note of which is used when creating the initial declaration. Previously, we would wait until later to handle default/delete as a definition, but this is too late: when adding the declaration, we already treated the declaration as "user-provided" when in fact it was merely "user-declared". Fixes PR10861 and PR10442, along with a bunch of FIXMEs. llvm-svn: 144011
* Simplify RecordDeclCXX::setBases slightly. No functional change.Richard Smith2011-10-181-0/+4
| | | | | | | Add test that a variadic base list which expands to 0 bases doesn't make the class a non-aggregate. This test passed before the change, too. llvm-svn: 142411
* Switch to the C++11 warning flags in tests. David Blaikie2011-10-182-2/+2
| | | | | | Patch by Ahmed Charles! llvm-svn: 142340
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-1316-16/+16
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* When adding a direct initializer to a declaration, allow theDouglas Gregor2011-10-101-0/+7
| | | | | | | | initializer to update the type of the declaration. For example, this allows us to determine the size of an incomplete array from its initializer. Fixes PR10288. llvm-svn: 141543
* Don't allow an rvalue reference to bind to the result of a calling aDouglas Gregor2011-10-041-4/+19
| | | | | | | | | conversion function whose result type is an lvalue reference. The initialization code already handled this properly, but overload resolution was allowing the binding. Fixes PR11003 / <rdar://problem/10233078>. llvm-svn: 141137
* constexpr functions are implicitly const. More tests to follow.Richard Smith2011-09-301-2/+2
| | | | llvm-svn: 140831
* Basic/Diagnostics: Rewrite DiagnosticIDs::getDiagnosticLevel completely to ↵Daniel Dunbar2011-09-291-1/+1
| | | | | | | | be straighter line code, use the new DiagnosticMappingInfo flags, and eliminate the odd MAP_WARNING_NO_WERROR and friend mappings. - This fixes a host of obscure bugs with regards to how warning mapping options composed with one another, and I believe makes the code substantially easier to read and reason about. llvm-svn: 140770
* Implement the suggested resolution of WG21 N3307 issue 19: When determining ↵Richard Smith2011-09-051-4/+3
| | | | | | whether a class is an aggregate in C++0x, treat all functions which are neither deleted nor defaulted as user-provided, not just special member functions. The wording of the standard only defines the term "user-provided" for special member functions, but the intent seems to be that any function can be user-provided. llvm-svn: 139111
* 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 PR10694: Boolean conversions can be from pointers, and those conversionsJeffrey Yasskin2011-08-301-0/+3
| | | | | | aren't considered narrowing conversions. llvm-svn: 138838
* Declare and define implicit move constructor and assignment operator.Sebastian Redl2011-08-301-1/+1
| | | | | | | | | This makes the code duplication of implicit special member handling even worse, but the cleanup will have to come later. For now, this works. Follow-up with tests for explicit defaulting and enabling the __has_feature flag to come. llvm-svn: 138821
* Print 'int' instead of 'const int' in the narrowing conversion error, since theJeffrey Yasskin2011-08-291-0/+10
| | | | | | | | | qualification of a type doesn't affect whether a conversion is a narrowing conversion. This doesn't work in template cases because SubstTemplateTypeParmType gets in the way. llvm-svn: 138735
* Teach reference initialization from the result of a user-definedDouglas Gregor2011-08-151-0/+15
| | | | | | | conversion to initialize the standard conversion *after* the user-defined conversion properly. Fixes PR10644. llvm-svn: 137608
* Conversions to bool count as integer conversions for the purposes ofJeffrey Yasskin2011-08-121-0/+6
| | | | | | the C++0x narrowing error. llvm-svn: 137512
* 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
* This patch implements as much of the narrowing conversion error specified byJeffrey Yasskin2011-07-262-0/+189
| | | | | | | | | | | | | | | [dcl.init.list] as is possible without generalized initializer lists or full constant expression support, and adds a c++0x-compat warning in C++98 mode. The FixIt currently uses a typedef's basename without qualification, which is likely to be incorrect on some code. If it's incorrect on too much code, we should write a function to get the string that refers to a type from a particular context. The warning is currently off by default. I'll fix LLVM and clang before turning it on. llvm-svn: 136181
* Revert 135177 to fix PR10363.Rafael Espindola2011-07-141-0/+63
| | | | | | | | Revert "For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either." This reverts commit ac420c5053d6aa41d59f782caad9e46e5baaf2c2. llvm-svn: 135210
* For C++11, do more checking of initializer lists up-front, enabling some ↵Sebastian Redl2011-07-141-63/+0
| | | | | | | | | | subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either. This is a first baby step towards supporting generalized initializer lists. This also removes an aggregate test case that was just plain wrong, assuming that non-aggregates couldn't be initialized with initializer lists in C++11 mode. llvm-svn: 135177
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-112-0/+107
| | | | llvm-svn: 132878
* Teach Sema::ActOnUninitializedDecl() not to try to interpret when oneDouglas Gregor2011-05-211-0/+12
| | | | | | | | should use a constructor to default-initialize a variable. InitializationSequence knows the rules for default initialization, better. Fixes <rdar://problem/8501008>. llvm-svn: 131796
* PR9669: implement correct checking for [dcl.init.string]p2.Eli Friedman2011-04-111-0/+2
| | | | llvm-svn: 129260
* 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
* Implement the C++0x deduced 'auto' feature.Richard Smith2011-02-202-0/+6
| | | | | | This fixes PR 8738, 9060 and 9132. llvm-svn: 126069
* Cope with parenthesized function declarators when emitting aDouglas Gregor2011-01-271-0/+2
| | | | | | diagnostic about ref-qualifiers where they do not belong. llvm-svn: 124344
OpenPOWER on IntegriCloud