summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Implement isDefined by call to isThisDeclarationADefinition.Serge Pavlov2017-06-041-3/+3
| | | | | | | | | | Modifies FunctionDecl::isThisDeclarationADefinition so that it covers all the cases checked by FunctionDecl::isDefined. Implements the latter method by call to isThisDeclarationADefinition. This change is a part of the patch D30170. llvm-svn: 304684
* Fix rejects-valid caused by r261297.Nico Weber2016-02-241-0/+33
| | | | | | | | | | | | | | | | r261297 called hasUserProvidedDefaultConstructor() to check if defining a const object is ok. This is incorrect for this example: struct X { template<typename ...T> X(T...); int n; }; const X x; // formerly OK, now bogus error Instead, track if a class has a defaulted default constructor, and disallow a const object for classes that either have defaulted default constructors or if they need an implicit constructor. Bug report and fix approach by Richard Smith, thanks! llvm-svn: 261770
* Implement the likely resolution of core issue 253.Nico Weber2016-02-191-0/+60
| | | | | | | | | | | | | | | | | | C++11 requires const objects to have a user-provided constructor, even for classes without any fields. DR 253 relaxes this to say "If the implicit default constructor initializes all subobjects, no initializer should be required." clang is currently the only compiler that implements this C++11 rule, and e.g. libstdc++ relies on something like DR 253 to compile in newer versions. This change makes it possible to build code that says `const vector<int> v;' again when using libstdc++5.2 and _GLIBCXX_DEBUG (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60284). Fixes PR23381. http://reviews.llvm.org/D16552 llvm-svn: 261297
* Move fixit for const init from note to diag, weaken to warning in MS mode.Nico Weber2015-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r235046 turned "extern __declspec(selectany) int a;" from a declaration into a definition to fix PR23242 (required for compatibility with mc.exe output). However, this broke parsing Windows headers: A d3d11 headers contain something like struct SomeStruct {}; extern const __declspec(selectany) SomeStruct some_struct; This is now a definition, and const objects either need an explicit default ctor or an initializer so this errors out with d3d11.h(1065,48) : error: default initialization of an object of const type 'const CD3D11_DEFAULT' without a user-provided default constructor (cl.exe just doesn't implement this rule, independent of selectany.) To work around this, weaken this error into a warning for selectany decls in microsoft mode, and recover with zero-initialization. Doing this is a bit hairy since it adds a fixit on an error emitted by InitializationSequence – this means it needs to build a correct AST, which in turn means InitializationSequence::Failed() cannot return true when this fixit is applied. As a workaround, the patch adds a fixit member to InitializationSequence, and InitializationSequence::Perform() prints the diagnostic if the fixit member is set right after its call to Diagnose. That function is usually called when InitializationSequences are used – InitListChecker::PerformEmptyInit() doesn't call it, but the InitListChecker case never performs default-initialization, so this is technically OK. This is the alternative, original fix for PR20208 that got reviewed in the thread "[patch] Improve diagnostic on default-initializing const variables (PR20208)". This change basically reverts r213725, adds the original fix for PR20208, and makes the error a warning in Microsoft mode. llvm-svn: 235166
* Add tests for two more asserts that r226365 fixed according to SLi's bot.Nico Weber2015-01-171-0/+12
| | | | llvm-svn: 226371
* Add a test for something that used to crash before r226365.Nico Weber2015-01-171-0/+10
| | | | llvm-svn: 226370
* Improve diagnostic on default-initializing const variables (PR20208).Nico Weber2014-07-231-1/+1
| | | | | | | | This tweaks the diagnostic wording slighly, and adds a fixit on a note. An alternative would be to add the fixit directly on the diagnostic, see the review thread linked to from the bug for a few notes on that approach. llvm-svn: 213725
* PR16638, DR1552: the exception specification on an implicitly-declaredRichard Smith2014-02-071-1/+1
| | | | | | | | | | | 'operator delete' or 'operator delete[]' is an explicit exception specification. Therefore we should diagnose 'void operator delete(void*)' instead of 'void operator delete(void*) noexcept'. This diagnostic remains an ExtWarn, since in practice people don't always include the exception specification in such a declaration. llvm-svn: 201002
* Add implicit declarations of allocation functions when looking them up forRichard Smith2014-02-041-0/+4
| | | | | | | | redeclaration, not just when looking them up for a use -- we need the implicit declaration to appropriately check various properties of them (notably, whether they're deleted). llvm-svn: 200729
* Properly compute triviality for explicitly-defaulted or deleted special members.Richard Smith2012-12-081-7/+11
| | | | | | | | | | | | | | 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
* Explicitly defaulted constructors cannot be used for default initialization.Aaron Ballman2012-07-311-2/+3
| | | | llvm-svn: 161088
* Fold the six functions checking explicitly-defaulted special member functionsRichard Smith2012-05-151-7/+9
| | | | | | | | | | | | 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
* Allow thread safety attributes on function definitions.DeLesley Hutchins2012-02-161-0/+6
| | | | | | | | For compatibility with gcc, clang will now parse gcc attributes on function definitions, but issue a warning if the attribute is not a thread safety attribute. Warning controlled by -Wgcc-compat. llvm-svn: 150698
* 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
* constexpr functions are implicitly const. More tests to follow.Richard Smith2011-09-301-1/+1
| | | | llvm-svn: 140831
* Fix some minor bugs and add a lot more test cases for defaultedAlexis Hunt2011-05-171-0/+69
constructors, including two more FIXMEs (one of which I don't actually understand). llvm-svn: 131487
OpenPOWER on IntegriCloud