summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/dcl.decl/dcl.init
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Fold the six functions checking explicitly-defaulted special member functionsRichard Smith2012-05-151-1/+1
| | | | | | | | | | | | 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
* 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
* 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
* 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
* 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
* 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-136-6/+6
| | | | | | -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
* 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
* 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
* 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
* Re-instate r123977/r123978, my updates of the reference-bindingDouglas Gregor2011-01-241-1/+33
| | | | | | | | | | | | | | | | implementation used by overload resolution to support rvalue references. The original commits caused PR9026 and some hard-to-reproduce self-host breakage. The only (crucial!) difference between this commit and the previous commits is that we now properly check the SuppressUserConversions flag before attempting to perform a second user-defined conversion in reference binding, breaking the infinite recursion chain of user-defined conversions. Rvalue references should be working a bit better now. llvm-svn: 124121
* revert r123977 and r123978 to fix PR9026.Rafael Espindola2011-01-221-33/+1
| | | | llvm-svn: 124033
* Update the reference-binding implementation used for overloadDouglas Gregor2011-01-211-1/+33
| | | | | | | | resolution to match the latest C++0x working paper's semantics. The implementation now matching up with the reference-binding implementation used for initialization. llvm-svn: 123977
* Add more reference-binding examples from the C++0x working paper, all of ↵Douglas Gregor2011-01-211-3/+28
| | | | | | which seem to be working fine llvm-svn: 123955
* More work to bring reference binding up to the latest C++0xDouglas Gregor2011-01-211-1/+25
| | | | | | | | | | specification. In particular, an rvalue reference can bind to an initializer expression that is an lvalue if the referent type and the initializer expression type are not reference-related. This is a newer formulation to the previous "rvalue references can never bind to lvalues" rule. llvm-svn: 123952
* When performing reference binding via a conversion function, performDouglas Gregor2011-01-211-4/+3
| | | | | | | type checking based on the actual reference type we're trying to bind the result to, rather than stripping the reference. llvm-svn: 123950
* More tests for reference binding in the presence of rvalueDouglas Gregor2011-01-201-0/+27
| | | | | | | references. Note that we're currently failing reference binding to a function lvalue. llvm-svn: 123920
* Start refactoring reference binding to more closely match the C++0xDouglas Gregor2011-01-201-3/+22
| | | | | | | working paper's structure. The only functional change here is that we now handling binding to array rvalues, which we would previously reject. llvm-svn: 123918
* Add some tests for reference-collapsing and referencing bindingDouglas Gregor2011-01-201-0/+38
| | | | | | | | | involving rvalue references, to start scoping out what is and what isn't implemented. In the process, tweak some standards citations, type desugaring, and teach the tentative parser about && in ptr-operator. llvm-svn: 123913
* Calculate the value kind of an expression when it's created andJohn McCall2010-11-181-5/+5
| | | | | | | | | | | | | store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. llvm-svn: 119685
* When performing initialization of a copy of a temporary object, useDouglas Gregor2010-11-121-1/+1
| | | | | | | direct-initialization (rather than copy-initialization) to initialize the temporary, allowing explicit constructors. Fixes PR8342. llvm-svn: 118880
* In Sema's TryRefInitWithConversionFunction, suppress user conversions for ↵Argyrios Kyrtzidis2010-10-051-1/+1
| | | | | | | | | the overload candidates. Fixes an infinite recursion in overload resolution for rdar://8499524. Many thanks to Doug! llvm-svn: 115588
* 'const std::type_info*' instead of 'std::type_info const*'Chris Lattner2010-09-053-15/+15
| | | | llvm-svn: 113092
* make clang print types as "const int *" instead of "int const*",Chris Lattner2010-09-053-5/+5
| | | | | | | which is should have done from the beginning. As usual, the most fun with this sort of change is updating all the testcases. llvm-svn: 113090
* Fix a regression that allowed clearly ill formed code. The diagnostic is stillChandler Carruth2010-08-311-0/+20
| | | | | | terrible, FIXME left to do a proper job of diagnosing this. llvm-svn: 112581
* PR7245: Make binding a reference to a temporary without a usable copyJeffrey Yasskin2010-06-072-8/+38
| | | | | | constructor into an extension warning into the error that C++98 requires. llvm-svn: 105529
* There is no dcl.init.ref p16. This test deals with p5.Jeffrey Yasskin2010-06-021-0/+0
| | | | llvm-svn: 105351
* Actually produce base paths for CastExprs of kind CK_DerivedToBase.Anders Carlsson2010-04-241-4/+4
| | | | llvm-svn: 102259
* When checking the copy constructor for the optional copy during aDouglas Gregor2010-04-182-5/+14
| | | | | | | | | reference binding to an rvalue of reference-compatible type, check parameters after the first for complete parameter types and build any required default function arguments. We're effectively simulating the type-checking for a call without building the call itself. llvm-svn: 101705
* In C++98/03, when binding a reference to an rvalue ofDouglas Gregor2010-04-182-0/+102
| | | | | | | | | | | | | | | | | reference-compatible type, the implementation is permitted to make a copy of the rvalue (or many such copies, even). However, even though we don't make that copy, we are required to check for the presence of a suitable copy constructor. With this change, we do. Note that in C++0x we are not allowed to make these copies, so we test both dialects separately. Also note the FIXME in one of the C++03 tests, where we are not instantiating default function arguments for the copy constructor we pick (but do not call). The fix is obvious; eliminating the infinite recursion it causes is not. Will address that next. llvm-svn: 101704
OpenPOWER on IntegriCloud