summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/drs
Commit message (Collapse)AuthorAgeFilesLines
...
* DR1315: a non-type template argument in a partial specialization is permittedRichard Smith2016-12-281-0/+28
| | | | | | | | | | to make reference to template parameters. This is only a partial implementation; we retain the restriction that the argument must not be type-dependent, since it's unclear how that would work given the existence of other language rules requiring an exact type match in this context, even for type-dependent cases (a question has been raised on the core reflector). llvm-svn: 290647
* DR1495: A partial specialization is ill-formed if it is not (strictly) moreRichard Smith2016-12-271-0/+28
| | | | | | | | specialized than the primary template. (Put another way, if we imagine there were a partial specialization matching the primary template, we should never select it if some other partial specialization also matches.) llvm-svn: 290593
* Make '-disable-llvm-optzns' an alias for '-disable-llvm-passes'.Chandler Carruth2016-12-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Much to my surprise, '-disable-llvm-optzns' which I thought was the magical flag I wanted to get at the raw LLVM IR coming out of Clang deosn't do that. It still runs some passes over the IR. I don't want that, I really want the *raw* IR coming out of Clang and I strongly suspect everyone else using it is in the same camp. There is actually a flag that does what I want that I didn't know about called '-disable-llvm-passes'. I suspect many others don't know about it either. It both does what I want and is much simpler. This removes the confusing version and makes that spelling of the flag an alias for '-disable-llvm-passes'. I've also moved everything in Clang to use the 'passes' spelling as it seems both more accurate (*all* LLVM passes are disabled, not just optimizations) and much easier to remember and spell correctly. This is part of simplifying how Clang drives LLVM to make it cleaner to wire up to the new pass manager. Differential Revision: https://reviews.llvm.org/D28047 llvm-svn: 290392
* Add test for DR692.Richard Smith2016-12-201-0/+63
| | | | llvm-svn: 290166
* Improve error message when referencing a non-tag type with a tagReid Kleckner2016-12-092-4/+4
| | | | | | | | | | | | | | | | | | | | Other compilers accept invalid code here that we reject, and we need a better error message to try to convince users that the code is really incorrect. Consider: class Foo { typedef MyIterHelper<Foo> iterator; friend class iterator; }; Previously our wording was "elaborated type refers to a typedef". "elaborated type" isn't widely known terminology, so the new diagnostic says "typedef 'iterator' cannot be referenced with class specifier". Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D25216 llvm-svn: 289259
* Add tests for a couple more DRs.Richard Smith2016-12-094-4/+57
| | | | llvm-svn: 289258
* cxx_dr_status: update to latest issue list and add a couple more tests.Richard Smith2016-12-092-4/+84
| | | | llvm-svn: 289255
* DR1295 and cleanup for P0135R1: Make our initialization code more directlyRichard Smith2016-12-091-2/+26
| | | | | | | | | | | | | | | mirror the description in the standard. Per DR1295, this means that binding a const / rvalue reference to a bit-field no longer "binds directly", and per P0135R1, this means that we materialize a temporary in reference binding after adjusting cv-qualifiers and before performing a derived-to-base cast. In C++11 onwards, this should have fixed the last case where we would materialize a temporary of the wrong type (with a subobject adjustment inside the MaterializeTemporaryExpr instead of outside), but we still have to deal with that possibility in C++98, unless we want to start using xvalues to represent materialized temporaries there too. llvm-svn: 289250
* [c++1z] P0003R5: Removing dynamic exception specifications.Richard Smith2016-12-086-15/+48
| | | | | | | | | | | | | | | | | | 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-064-28/+83
| | | | | | | | 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
* DR1213: element access on an array xvalue or prvalue produces an xvalue. In theRichard Smith2016-12-051-0/+11
| | | | | | | | | | | | | | latter case, a temporary array object is materialized, and can be lifetime-extended by binding a reference to the member access. Likewise, in an array-to-pointer decay, an rvalue array is materialized before being converted into a pointer. This caused IR generation to stop treating file-scope array compound literals as having static storage duration in some cases in C++; that has been rectified by modeling such a compound literal as an lvalue. This also improves clang's compatibility with GCC for those cases. llvm-svn: 288654
* [Sema] Don't perform aggregate initialization for types with explicit ↵Eric Fiselier2016-12-031-0/+47
| | | | | | | | | | | | | | | | constructors Summary: The C++17 rules for aggregate initialization changed to disallow types with explicit constructors [dcl.init.aggr]p1. This patch implements that new rule. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25654 llvm-svn: 288565
* DR616, and part of P0135R1: member access (or pointer-to-member access) on aRichard Smith2016-12-032-8/+14
| | | | | | | temporary produces an xvalue, not a prvalue. Support this by materializing the temporary prior to performing the member access. llvm-svn: 288563
* PR23281: Fix implementation of DR1891 to implement the intent: that is, aRichard Smith2016-11-161-3/+8
| | | | | | lambda-expression does not have a move-assignment operator. llvm-svn: 287057
* 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-222-4/+21
| | | | | | | | | | | | | | 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
* DR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' rules.Richard Smith2016-10-212-8/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | This has two significant effects: 1) Direct relational comparisons between null pointer constants (0 and nullopt) and pointers are now ill-formed. This was always the case for C, and it appears that C++ only ever permitted by accident. For instance, cases like nullptr < &a are now rejected. 2) Comparisons and conditional operators between differently-cv-qualified pointer types now work, and produce a composite type that both source pointer types can convert to (when possible). For instance, comparison between 'int **' and 'const int **' is now valid, and uses an intermediate type of 'const int *const *'. Clang previously supported #2 as an extension. We do not accept the cases in #1 as an extension. I've tested a fair amount of code to check that this doesn't break it, but if it turns out that someone is relying on this, we can easily add it back as an extension. This is a re-commit of r284800. llvm-svn: 284890
* Revert "DR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' ↵Renato Golin2016-10-212-135/+8
| | | | | | | | rules." This reverts commit r284800, as it failed all ARM/AArch64 bots. llvm-svn: 284811
* DR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' rules.Richard Smith2016-10-212-8/+135
| | | | | | | | | | | | | | | | | | | | | | | | This has two significant effects: 1) Direct relational comparisons between null pointer constants (0 and nullopt) and pointers are now ill-formed. This was always the case for C, and it appears that C++ only ever permitted by accident. For instance, cases like nullptr < &a are now rejected. 2) Comparisons and conditional operators between differently-cv-qualified pointer types now work, and produce a composite type that both source pointer types can convert to (when possible). For instance, comparison between 'int **' and 'const int **' is now valid, and uses an intermediate type of 'const int *const *'. Clang previously supported #2 as an extension. We do not accept the cases in #1 as an extension. I've tested a fair amount of code to check that this doesn't break it, but if it turns out that someone is relying on this, we can easily add it back as an extension. llvm-svn: 284800
* DR1330: instantiate exception-specifications when "needed". We previously didRichard Smith2016-10-181-0/+85
| | | | | | | | | | | | | | | | | | | | not instantiate exception specifications of functions if they were only used in unevaluated contexts (other than 'noexcept' expressions). In C++17 onwards, this becomes essential since the exception specification is now part of the function's type. Note that this means that constructs like the following no longer work: struct A { static T f() noexcept(...); decltype(f()) *p; }; ... because the decltype expression now needs the exception specification of 'f', which has not yet been parsed. llvm-svn: 284549
* P0012R1: Make exception specifications be part of the type system. ThisRichard Smith2016-10-163-18/+55
| | | | | | | 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
* P0035R4: add std::align_val_t overloads of operator new/delete in C++17 mode.Richard Smith2016-09-291-0/+6
| | | | llvm-svn: 282800
* Fix clang's handling of the copy performed in the second phase of classRichard Smith2016-09-072-4/+4
| | | | | | | | | | | | | | | | | | | | | | | 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
* DR259: Demote the pedantic error for an explicit instantiation after anRichard Smith2016-08-311-12/+5
| | | | | | | | | explicit specialization to a warning for C++98 mode (this is a defect report resolution, so per our informal policy it should apply in C++98), and turn the warning on by default for C++11 and later. In all cases where it fires, the right thing to do is to remove the pointless explicit instantiation. llvm-svn: 280308
* Push alias-declarations and alias-template declarations into scope even ifRichard Smith2016-07-151-2/+2
| | | | | | | | they're redeclarations. This is necessary in order for name lookup to correctly find the most recent declaration of the name (which affects default template argument lookup and cross-module merging, among other things). llvm-svn: 275612
* [Sema] Implement C++14's DR1579: Prefer returning by converting move constructorErik Pilkington2016-06-301-0/+56
| | | | | | | | Fixes PR28096. Differential Revision: http://reviews.llvm.org/D21619 llvm-svn: 274291
* Mark inheriting constructors as deleted if the corresponding defaulted defaultRichard Smith2016-06-291-3/+3
| | | | | | | | constructor would be; this is effectively required by P0136R1. This has the effect of exposing the validity of the base class initialization steps to SFINAE checks. llvm-svn: 274088
* P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:Richard Smith2016-06-284-10/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace inheriting constructors implementation with new approach, voted into C++ last year as a DR against C++11. Instead of synthesizing a set of derived class constructors for each inherited base class constructor, we make the constructors of the base class visible to constructor lookup in the derived class, using the normal rules for using-declarations. For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived class that tracks the requisite additional information. We create shadow constructors (not found by name lookup) in the derived class to model the actual initialization, and have a new expression node, CXXInheritedCtorInitExpr, to model the initialization of a base class from such a constructor. (This initialization is special because it performs real perfect forwarding of arguments.) In cases where argument forwarding is not possible (for inalloca calls, variadic calls, and calls with callee parameter cleanup), the shadow inheriting constructor is not emitted and instead we directly emit the initialization code into the caller of the inherited constructor. Note that this new model is not perfectly compatible with the old model in some corner cases. In particular: * if B inherits a private constructor from A, and C uses that constructor to construct a B, then we previously required that A befriends B and B befriends C, but the new rules require A to befriend C directly, and * if a derived class has its own constructors (and so its implicit default constructor is suppressed), it may still inherit a default constructor from a base class llvm-svn: 274049
* Add test for DR1359.Richard Smith2016-06-131-0/+16
| | | | llvm-svn: 272575
* Fix implementation of C++'s restrictions on using-declarations referring to ↵Richard Smith2016-05-051-2/+2
| | | | | | | | | | | enumerators: * an unscoped enumerator whose enumeration is a class member is itself a class member, so can only be the subject of a class-scope using-declaration. * a scoped enumerator cannot be the subject of a class-scope using-declaration. llvm-svn: 268594
* [Parser] Clear the TemplateParamScope bit of the current scope's flagAkira Hatanaka2016-04-291-0/+4
| | | | | | | | | | | | | | | | | | | | | | | if we are parsing a template specialization. This commit makes changes to clear the TemplateParamScope bit and set the TemplateParamParent field of the current scope to null if a template specialization is being parsed. Before this commit, Sema::ActOnStartOfLambdaDefinition would check whether the parent template scope had any decls to determine whether or not a template specialization was being parsed. This wasn't correct since it couldn't distinguish between a real template specialization and a template defintion with an unnamed template parameter (only template parameters with names are added to the scope's decl list). To fix the bug, this commit changes the code to check the pointer to the parent template scope rather than the decl list. rdar://problem/23440346 Differential Revision: http://reviews.llvm.org/D19175 llvm-svn: 267975
* Make SemaAccess smarter about determining when a dependent class mightRichard Smith2016-03-231-3/+16
| | | | | | | instantiate to match a friend class declaration. It's still pretty dumb, though. llvm-svn: 264189
* Implement the likely resolution of core issue 253.Nico Weber2016-02-191-2/+2
| | | | | | | | | | | | | | | | | | 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
* Mark DR1250 as implementedDavid Majnemer2016-02-011-0/+18
| | | | | | | We implemented this DR back in r258768 but forgot to mark it as implemented. llvm-svn: 259335
* Improve diagnostic for the case where a function template candidate is rejectedRichard Smith2015-12-311-2/+1
| | | | | | | | by overload resolution because deduction succeeds, but the substituted parameter type for some parameter (with deduced type) doesn't exactly match the corresponding adjusted argument type. llvm-svn: 256657
* Add some more tests for initializer lists related to CWG1591Faisal Vali2015-12-111-0/+20
| | | | llvm-svn: 255323
* Fix PR24694 (CWG1591): Deducing array bound and element type from ↵Faisal Vali2015-12-101-0/+51
| | | | | | | | | | | | | | | initializer list https://llvm.org/bugs/show_bug.cgi?id=24694 http://wg21.link/cwg1591 Teach DeduceFromInitializerList in SemaTemplateDeduction.cpp to deduce against array (constant and dependent sized) parameters (really, reference to arrays since they don't decay to pointers), by checking if the template parameter is either one of those kinds of arrays, and if so, deducing each initializer list element against the element type, and then deducing the array bound if needed. In brief, this patch enables the following code: template<class T, int N> int *f(T (&&)[N]); int *ip = f({1, 2, 3}); llvm-svn: 255221
* [PR25661] Revert part of r217213 according to r254323.NAKAMURA Takumi2015-11-301-13/+2
| | | | llvm-svn: 254346
* P0002R1: increment on expressions of type bool is no longer allowed in C++1z.Richard Smith2015-11-261-0/+5
| | | | llvm-svn: 254122
* DR407: Rationalize how we handle tags being hidden by typedefs. Even withRichard Smith2015-11-121-9/+9
| | | | | | | | | | | | | | | | | | DR407, the C++ standard doesn't really say how this should work. Here's what we do (which is consistent with DR407 as far as I can tell): * When performing name lookup for an elaborated-type-specifier, a tag declaration hides a typedef declaration that names the same type. * When performing any other kind of lookup, a typedef declaration hides a tag declaration that names the same type. In any other case where lookup finds both a typedef and a tag (that is, when they name different types), the lookup will be ambiguous. If lookup finds a tag and a typedef that name the same type, and finds anything else, the lookup will always be ambiguous (even if the other entity would hide the tag, it does not also hide the typedef). llvm-svn: 252959
* N3922: direct-list-initialization of an auto-typed variable no longer deduces aRichard Smith2015-11-111-6/+6
| | | | | | | | | | | | | | | | | | | std::initializer_list<T> type. Instead, the list must contain a single element and the type is deduced from that. In Clang 3.7, we warned by default on all the cases that would change meaning due to this change. In Clang 3.8, we will support only the new rules -- per the request in N3922, this change is applied as a Defect Report against earlier versions of the C++ standard. This change is not entirely trivial, because for lambda init-captures we previously did not track the difference between direct-list-initialization and copy-list-initialization. The difference was not previously observable, because the two forms of initialization always did the same thing (the elements of the initializer list were always copy-initialized regardless of the initialization style used for the init-capture). llvm-svn: 252688
* Update tests touched by r249656David Majnemer2015-10-083-8/+8
| | | | | | | | | 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
* Promote a warning on ill-formed code (redeclaration missing an exceptionRichard Smith2015-09-302-2/+2
| | | | | | | | | | | | | | | | | specification) to an error. No compiler other than Clang seems to allow this, and it doesn't seem like a useful thing to accept as an extension in general. The current behavior was added for PR5957, where the problem was specifically related to mismatches of the exception specification on the implicitly-declared global operator new and delete. To retain that workaround, we downgrade the error to an ExtWarn when the declaration is of a replaceable global allocation function. Now that this is an error, stop trying (and failing) to recover from a missing computed noexcept specification. That recovery didn't work, and led to crashes in code like the added testcase. llvm-svn: 248867
* DR1909: Diagnose all invalid cases of a class member sharing its name with ↵Richard Smith2015-07-062-12/+15
| | | | | | the class. llvm-svn: 241425
* When we see something that looks like a constructor with a return type, only ↵Richard Smith2015-07-061-2/+2
| | | | | | issue one error, not two. llvm-svn: 241424
* [Parse] Allow 'constexpr' in condition declarationsMeador Inge2015-06-251-0/+29
| | | | | | | | | | | | | | | | | This patch implements the functionality specified by DR948. The changes are two fold. First, the parser was modified to allow 'constexpr's to appear in condition declarations (which was a hard error before). Second, Sema was modified to cleanup maybe odr-used declarations by way of a call to 'ActOnFinishFullExpr'. As 'constexpr's were not allowed in condition declarations before the cleanup wasn't necessary (such declarations were always odr-used). This fixes PR22491. Differential Revision: http://reviews.llvm.org/D8978 llvm-svn: 240707
* DR295: cv-qualifiers on function types are ignored in C++.Richard Smith2015-05-141-5/+10
| | | | llvm-svn: 237383
* 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-172-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud