summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/drs/dr0xx.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add missing diagnostic for explicit instantiation declarations namingRichard Smith2019-04-261-4/+3
| | | | | | | | | | | | | | | | | internal linkage entities. Such constructs are ill-formed by [temp.explicit]p13. We make a special exception to permit an invalid construct used by libc++ in some build modes: its <valarray> header declares some functions with the internal_linkage attribute and then (meaninglessly) provides explicit instantiation declarations for them. Luckily, Clang happens to effectively ignore the explicit instantiation declaration when generating code in this case, and this change codifies that behavior. This reinstates part of r359048, reverted in r359076. (The libc++ issue triggering the rollback has been addressed.) llvm-svn: 359259
* Revert r359048: C++ DR2387: a variable template declared wthiIlya Biryukov2019-04-241-3/+4
| | | | | | | | | | | | | The change breaks libc++ with the follwing error: In file included from valarray:4: .../include/c++/v1/valarray:1062:60: error: explicit instantiation declaration of 'valarray<_Tp>' with internal linkage _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t)) ^ .../include/c++/v1/valarray:1063:60: error: explicit instantiation declaration of '~valarray<_Tp>' with internal linkage _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray()) llvm-svn: 359076
* C++ DR2387: a variable template declared wtih (or instantiated with) aRichard Smith2019-04-231-4/+3
| | | | | | | const-qualified type is not implicitly given internal linkage. But a variable template declared 'static' is. llvm-svn: 359048
* PR40329: [adl] Fix determination of associated classes when searching aRichard Smith2019-01-161-0/+30
| | | | | | | | | | | | | | | | | | | | | | | member enum and then its enclosing class. There are situations where ADL will collect a class but not the complete set of associated classes / namespaces of that class. When that happened, and we later tried to collect those associated classes / namespaces, we would previously short-circuit the lookup and not find them. Eg, for: struct A : B { enum E; }; if we first looked for associated classes/namespaces of A::E, we'd find only A. But if we then tried to also collect associated classes/namespaces of A (which should include the base class B), we would not add B because we had already visited A. This also fixes a minor issue where we would fail to collect associated classes from an overloaded class member access expression naming a static member function. llvm-svn: 351382
* Related to PR37768: improve diagnostics for class name shadowing.Richard Smith2018-06-201-3/+2
| | | | | | | | | | | | Diagnose the name of the class being shadowed by using declarations, and improve the diagnostics for the case where the name of the class is shadowed by a non-static data member in a class with constructors. In the latter case, we now always give the "member with the same name as its class" diagnostic regardless of the relative order of the member and the constructor, rather than giving an inscrutible diagnostic if the constructor appears second. llvm-svn: 335182
* Implement C++ DR727, which permits explicit specializations at class scope.Richard Smith2018-03-161-2/+2
| | | | | | | | | More generally, this permits a template to be specialized in any scope in which it could be defined, so this also supersedes DR44 and DR374 (the latter of which we previously only implemented in C++11 mode onwards due to unclarity as to whether it was a DR). llvm-svn: 327705
* Replace remaining user-visible mentions of C++1z with C++17.Richard Smith2017-08-131-10/+10
| | | | llvm-svn: 310804
* Update C++ status pages for Clang 4 branch:Richard Smith2017-01-131-1/+1
| | | | | | | | | | | | * Update version number in DR tests from 4.0 to 4 * Teach make_cxx_dr_status script about version numbers that don't contain a period. * Update cxx_status.html and cxx_dr_status.html to list Clang 4 features as "Clang 4" rather than "SVN" Clang 4 features are still listed in yellow rather than green until release. llvm-svn: 291871
* Add tests for a couple more DRs.Richard Smith2016-12-091-1/+1
| | | | llvm-svn: 289258
* [c++1z] P0003R5: Removing dynamic exception specifications.Richard Smith2016-12-081-8/+8
| | | | | | | | | | | | | | | | | | We continue to support dynamic exception specifications in C++1z as an extension, but produce an error-by-default warning when we encounter one. This allows users to opt back into the feature with a warning flag, and implicitly opts system headers back into the feature should they happen to use it. There is one semantic change implied by P0003R5 but not implemented here: violating a throw() exception specification should now call std::terminate directly instead of calling std::unexpected(), but since P0003R5 also removes std::unexpected() and std::set_unexpected, and the default unexpected handler calls std::terminate(), a conforming C++1z program cannot tell that we are still calling it. The upside of this strategy is perfect backwards compatibility; the downside is that we don't get the more efficient 'noexcept' codegen for 'throw()'. llvm-svn: 289019
* [c++17] P0135R1: Guaranteed copy elision.Richard Smith2016-12-061-15/+33
| | | | | | | | When an object of class type is initialized from a prvalue of the same type (ignoring cv qualifications), use the prvalue to initialize the object directly instead of inserting a redundant elidable call to a copy constructor. llvm-svn: 288866
* Implement name mangling proposal for exception specifications from ↵Richard Smith2016-10-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cxx-abi-dev 2016-10-11. This has the following ABI impact: 1) Functions whose parameter or return types are non-throwing function pointer types have different manglings in c++1z mode from prior modes. This is necessary because c++1z permits overloading on the noexceptness of function pointer parameter types. A warning is issued for cases that will change manglings in c++1z mode. 2) Functions whose parameter or return types contain instantiation-dependent exception specifications change manglings in all modes. This is necessary to support overloading on / SFINAE in these exception specifications, which a careful reading of the standard indicates has essentially always been permitted. Note that, in order to be affected by these changes, the code in question must specify an exception specification on a function pointer/reference type that is written syntactically within the declaration of another function. Such declarations are very rare, and I have so far been unable to find any code that would be affected by this. (Note that such things will probably become more common in C++17, since it's a lot easier to get a noexcept function type as a function parameter / return type there.) This change does not affect the set of symbols produced by a build of clang, libc++, or libc++abi. llvm-svn: 285150
* [c++1z] P0012R1: Implement a few remaining pieces: downgrade diagnostic forRichard Smith2016-10-221-3/+9
| | | | | | | | | | | | | | mismatched dynamic exception specifications in expressions from an error to a warning, since this is no longer ill-formed in C++1z. Allow reference binding of a reference-to-non-noexcept function to a noexcept function lvalue. As defect resolutions, also allow a conditional between noexcept and non-noexcept function lvalues to produce a non-noexcept function lvalue (rather than decaying to a function pointer), and allow function template argument deduction to deduce a reference to non-noexcept function when binding to a noexcept function type. llvm-svn: 284905
* P0012R1: Make exception specifications be part of the type system. ThisRichard Smith2016-10-161-12/+43
| | | | | | | implements the bulk of the change (modifying the type system to include exception specifications), but not all the details just yet. llvm-svn: 284337
* PR25890: Fix incoherent error handling in PerformImplicitConversion andRichard Smith2016-10-061-3/+2
| | | | | | | | | | | | CheckSingleAssignmentConstraints. These no longer produce ExprError() when they have not emitted an error, and reliably inform the caller when they *have* emitted an error. This fixes some serious issues where we would fail to emit any diagnostic for invalid code and then attempt to emit code for an invalid AST, and conversely some issues where we would emit two diagnostics for the same problem. llvm-svn: 283508
* Fix clang's handling of the copy performed in the second phase of classRichard Smith2016-09-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | copy-initialization. We previously got this wrong in a couple of ways: - we only looked for copy / move constructors and constructor templates for this copy, and thus would fail to copy in cases where doing so should use some other constructor (but see core issue 670), - we mishandled the special case for disabling user-defined conversions that blocks infinite recursion through repeated application of a copy constructor (applying it in slightly too many cases) -- though as far as I can tell, this does not ever actually affect the result of overload resolution, and - we misapplied the special-case rules for constructors taking a parameter whose type is a (reference to) the same class type by incorrectly assuming that only happens for copy/move constructors (it also happens for constructors instantiated from templates and those inherited from base classes). These changes should only affect strange corner cases (for instance, where the copy constructor exists but has a non-const-qualified parameter type), so for the most part it only causes us to produce more 'candidate' notes, but see the test changes for other cases whose behavior is affected. llvm-svn: 280776
* Update tests touched by r249656David Majnemer2015-10-081-3/+3
| | | | | | | | | These test updates almost exclusively around the change in behavior around enum: enums without a definition are considered incomplete except when targeting MSVC ABIs. Since these tests are interested in the 'incomplete-enum' behavior, restrict them to %itanium_abi_triple. llvm-svn: 249660
* Update cxx_dr_status to latest issues list.Richard Smith2015-05-141-1/+1
| | | | llvm-svn: 237382
* 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
* PR6037Nathan Sidwell2015-01-191-1/+1
| | | | | | Warn on inaccessible direct base llvm-svn: 226423
* [c++1z] Most of N4268 (allow constant evaluation for non-type template ↵Richard Smith2014-11-261-5/+20
| | | | | | | | | arguments). We don't yet support pointer-to-member template arguments that have undergone pointer-to-member conversions, mostly because we don't have a mangling for them yet. llvm-svn: 222807
* PR21327 / C++ DR1652 / C++ DR73: comparing a past-the-end pointer for oneRichard Smith2014-10-211-1/+1
| | | | | | | | complete object to a pointer to the start of another complete object does not evaluate to the constant 'false'. All other comparisons between the addresses of subobjects of distinct complete objects still do. llvm-svn: 220343
* Run DR tests in C++17 mode too.Richard Smith2014-09-281-1/+2
| | | | llvm-svn: 218580
* Reword switch/goto diagnostics "protected scope" diagnostics. Making up a termRichard Smith2014-09-061-4/+4
| | | | | | | | "protected scope" is very unhelpful here and actively confuses users. Instead, simply state the nature of the problem in the diagnostic: we cannot jump from here to there. The notes explain nicely why not. llvm-svn: 217293
* 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
* Revert "Fix the undefined-but-used odr-use marker (DR48)"Alp Toker2014-06-011-3/+4
| | | | | | | | Wrong patch got committed (this one isn't ready for prime time). This reverts commit r209996. llvm-svn: 209997
* Fix the undefined-but-used odr-use marker (DR48)Alp Toker2014-06-011-4/+3
| | | | | | | | | | | | | We should treat tentative definitions as undefined for the purpose of ODR-use linkage checking. This broke somewhere around r149731 when tests were disabled. Note that test coverage for these diagnostics is generally lacking due to a separate issue (PR19910: Don't suppress unused/undefined warnings when there are errors). llvm-svn: 209996
* More tests for DR1.Richard Smith2014-04-011-2/+18
| | | | llvm-svn: 205339
* Add tests for newly-resolved core issues <= 370.Richard Smith2014-03-041-0/+31
| | | | llvm-svn: 202889
* Implement DR577David Majnemer2014-02-191-4/+1
| | | | | | | | DR18 previously forebode typedefs to be used as parameter types if they were of type 'void'. DR577 allows 'void' to be used as a function parameter type regardless from where it came. llvm-svn: 201631
* Implement DR329. We already did the right thing here in C++98 mode, but r104014Richard Smith2014-02-031-12/+4
| | | | | | (which implemented the DR) was disabled in C++11. llvm-svn: 200673
* Provide better diagnostic wording for initializers on staticHans Wennborg2013-11-211-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | data member definitions when the variable has an initializer in its declaration. For the following code: struct S { static const int x = 42; }; const int S::x = 42; This patch changes the diagnostic from: a.cc:4:14: error: redefinition of 'x' const int S::x = 42; ^ a.cc:2:20: note: previous definition is here static const int x = 42; ^ to: a.cc:4:18: error: static data member 'x' already has an initializer const int S::x = 42; ^ a.cc:2:24: note: previous initialization is here static const int x = 42; ^ Differential Revision: http://llvm-reviews.chandlerc.com/D2235 llvm-svn: 195306
* Tests for core issue 241-250.Richard Smith2013-11-171-1/+1
| | | | llvm-svn: 194951
* Switch the semantic DeclContext for a block-scope declaration of a function orRichard Smith2013-09-201-10/+7
| | | | | | | | | | | | | | 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
* Sema: Diagnose explicitly bound unresolved member expressions decaying into ↵David Majnemer2013-08-011-0/+1
| | | | | | | | | | | | | pointers to function type We would disallow the case where the overloaded member expression is coming from an address-of operator but we wouldn't issue any diagnostics when the overloaded member expression comes by way of a function to pointer decay cast. Clang's implementation of DR61 is now seemingly complete. llvm-svn: 187559
* Implement DR21David Majnemer2013-06-251-4/+3
| | | | | | | | | | A default template-argument shall not be specified in a friend template declaration. Interestingly, we properly handled default template arguments on friend class members but not on just friend classes. llvm-svn: 184882
* Revert r184401 which reverted r183462.David Majnemer2013-06-221-3/+6
| | | | | | | | | | | | The problem with r183462 was that we assumed that a diagnostic id of zero would be silent. This small correction to CheckDerivedToBaseConversion changes it's behavior to omit the diagnostic when given a diagnostic id of zero. This fix passes the test case added in r184402. llvm-svn: 184631
* Add a regression test for PR16370 next to the dr7 test case since theyChandler Carruth2013-06-201-0/+12
| | | | | | | seem closely related. (I'm happy to move this if others have a better idea of where to put it.) llvm-svn: 184402
* Temporarily revert r183462: "Implement DR7"Chandler Carruth2013-06-201-6/+3
| | | | | | This fixes PR16370, I'll add the test case in a follow-up commit. llvm-svn: 184401
* DR14, DR101, and part of DR1: fix handling of extern "C" declarations inRichard Smith2013-06-181-16/+13
| | | | | | | namespaces, by treating them just like we treat extern "C" declarations in function scope. llvm-svn: 184223
* Add testcase for DR39 from PR5916.Richard Smith2013-06-161-0/+12
| | | | llvm-svn: 184056
* Fix some confusing diagnostic wording. s/implicit default/implicit/ if we'reRichard Smith2013-06-131-1/+1
| | | | | | not actually talking about a default constructor. llvm-svn: 183885
* Implement DR61: Address of ambiguous bound methods should be disallowedDavid Majnemer2013-06-111-3/+2
| | | | | | | DR61 affirms that expressions containing unresolved member access should be disallowed when performing "address of" operations. llvm-svn: 183723
* Implement DR85: Redeclaration of member is forbiddenDavid Majnemer2013-06-111-7/+23
| | | | | | | Disallow the existence of a declaration of a member class that isn't a forward declaration before it's definition. llvm-svn: 183722
* Implement DR7David Majnemer2013-06-061-3/+6
| | | | | | | | Disallowing deriving from classes that have private virtual base classes except in instances where the deriving class would be able to cast itself to the private virtual base via a different derivation. llvm-svn: 183462
* Tests and status for DR51-99.Richard Smith2013-05-261-10/+510
| | | | llvm-svn: 182720
* Tests and status for core issues 1-50.Richard Smith2013-05-191-0/+504
llvm-svn: 182207
OpenPOWER on IntegriCloud