summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/constexpr-instantiate.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Customize the SFINAE diagnostics for enable_if to provide the failed condition.Douglas Gregor2017-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | When enable_if disables a particular overload resolution candidate, rummage through the enable_if condition to find the specific condition that caused the failure. For example, if we have something like: template< typename Iter, typename = std::enable_if_t<Random_access_iterator<Iter> && Comparable<Iterator_value_type<Iter>>>> void mysort(Iter first, Iter last) {} and we call "mysort" with "std::list<int>" iterators, we'll get a diagnostic saying that the "Random_access_iterator<Iter>" requirement failed. If we call "mysort" with "std::vector<something_not_comparable>", we'll get a diagnostic saying that the "Comparable<...>" requirement failed. llvm-svn: 307196
* PR20090: Add (passing) test from this bug; it's been fixed for a while.Richard Smith2017-01-071-0/+7
| | | | llvm-svn: 291319
* PR23135: Don't instantiate constexpr functions referenced in unevaluated ↵Richard Smith2017-01-071-20/+64
| | | | | | | | | | | | | | | | | | | | | operands where possible. This implements something like the current direction of DR1581: we use a narrow syntactic check to determine the set of places where a constant expression could be evaluated, and only instantiate a constexpr function or variable if it's referenced in one of those contexts, or is odr-used. It's not yet clear whether this is the right set of syntactic locations; we currently consider all contexts within templates that would result in odr-uses after instantiation, and contexts within list-initialization (narrowing conversions take another victim...), as requiring instantiation. We could in principle restrict the former cases more (only const integral / reference variable initializers, and contexts in which a constant expression is required, perhaps). However, this is sufficient to allow us to accept libstdc++ code, which relies on GCC's behavior (which appears to be somewhat similar to this approach). llvm-svn: 291318
* Tweak diagnostic wording for init list narrowingAlp Toker2014-05-171-1/+1
| | | | | | | | | The conventional form is '<action> to silence this warning'. Also call the diagnostic an 'issue' rather than a 'message' because the latter term is more widely used with reference to message expressions. llvm-svn: 209052
* sizeof(void) etc. should be a hard error in C++.Eli Friedman2013-08-131-2/+2
| | | | | | PR16872. llvm-svn: 188324
* PR11851 (and duplicates): Whenever a constexpr function is referenced,Richard Smith2012-11-071-0/+133
| | | | | | | | | instantiate it if it can be instantiated and implicitly define it if it can be implicitly defined. This matches g++'s approach. Remove some cases from SemaOverload which were marking functions as referenced when just planning how overload resolution would proceed; such cases are not actually references. llvm-svn: 167514
* Ensure that we instantiate static reference data members of class templatesRichard Smith2012-03-021-0/+10
| | | | | | | | | early, since their values can be used in constant expressions in C++11. For odr-use checking, the opposite change is required, since references are odr-used whether or not they satisfy the requirements for appearing in a constant expression. llvm-svn: 151881
* If a static data member of a class template which could be used in a constantRichard Smith2012-02-151-0/+8
| | | | | | | | expression is referenced, defined, then referenced again, make sure we instantiate it the second time it's referenced. This is the static data member analogue of r150518. llvm-svn: 150560
* If a constexpr function template specialization is referenced, and then theRichard Smith2012-02-141-0/+59
template is defined, and then the specialization is referenced again, don't forget to instantiate the template on the second reference. Use the source location of the first reference as the point of instantiation, though. llvm-svn: 150518
OpenPOWER on IntegriCloud