summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/overload-candidates.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix test case in pre-C++11 mode; address Aaron Ballman's code review.Douglas Gregor2017-07-051-1/+1
| | | | llvm-svn: 307202
* Cope with Range-v3's CONCEPT_REQUIRES idiomDouglas Gregor2017-07-051-0/+26
| | | | llvm-svn: 307197
* Customize the SFINAE diagnostics for enable_if to provide the failed condition.Douglas Gregor2017-07-051-4/+4
| | | | | | | | | | | | | | | | | | | | 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
* [Lit Test] Updated 20 Lit tests to be C++11 compatible.Charles Li2015-12-101-6/+20
| | | | | | | | This is the 5th Lit test patch. Expanded expected diagnostics to vary by C++ dialect. Expanded RUN line to: default, C++98/03 and C++11. llvm-svn: 255196
* Part of PR15673: If a function template has a default argument in whichRichard Smith2013-07-041-0/+45
| | | | | | | | | substitution failed, report that as a substitution failure rather than pretending that there was no default argument. The test cases in PR15673 have exposed some pre-existing poor diagnostics here. llvm-svn: 185604
* Fix PR15634, better error message for template deduction failure.Richard Trieu2013-04-081-0/+17
| | | | | | | | | | | | | When two template decls with the same name are used in this diagnostic, force them to print their qualified names. This changes the bad message of: candidate template ignored: could not match 'array' against 'array' to the better message of: candidate template ignored: could not match 'NS2::array' against 'NS1::array' llvm-svn: 179056
* A little tweak to the SFINAE condition reporting. Don't say:Richard Smith2012-05-091-0/+22
| | | | | | | | | | | | | | candidate template ignored: substitution failed [with T = int]: no type named 'type' in 'std::enable_if<false, void>' Instead, just say: candidate template ignored: disabled by 'enable_if' [with T = int] ... and point at the enable_if condition which (we assume) failed. This is applied to all cases where the user writes 'typename enable_if<...>::type' (optionally prefixed with a nested name specifier), and 'enable_if<...>' names a complete class type which does not have a member named 'type', and this results in a candidate function being ignored in a SFINAE context. Thus it catches 'std::enable_if', 'std::__1::enable_if', 'boost::enable_if' and 'llvm::enable_if'. llvm-svn: 156463
* When we suppress an error due to SFINAE, stash the diagnostic away with theRichard Smith2012-05-071-1/+3
| | | | | | | | | | | | | | | | | | | overload candidate, and include its message in any subsequent 'candidate not viable due to substitution failure' note we may produce. To keep the note small (since the 'overload resolution failed' diagnostics are often already very verbose), the text of the SFINAE diagnostic is included as part of the text of the note, and any notes which were attached to it are discarded. There happened to be spare space in OverloadCandidate into which a PartialDiagnosticAt could be squeezed, and this patch goes to lengths to avoid unnecessary PartialDiagnostic copies, resulting in no slowdown that I could measure. (Removal in passing of some PartialDiagnostic copies has resulted in a slightly smaller clang binary overall.) Even on a torture test, I was unable to measure a memory increase of above 0.2%. llvm-svn: 156297
* Record template argument deduction failures for member functionDouglas Gregor2010-05-081-0/+9
| | | | | | templates and conversion function templates. llvm-svn: 103349
* When printing an overload candidate that failed due to SFINAE, print aDouglas Gregor2010-05-081-0/+7
| | | | | | | | | | | specific message that includes the template arguments, e.g., test/SemaTemplate/overload-candidates.cpp:27:20: note: candidate template ignored: substitution failure [with T = int *] typename T::type get_type(const T&); // expected-note{{candidate ... ^ llvm-svn: 103348
* Improve overload-candidate diagnostic for a function template thatDouglas Gregor2010-05-081-0/+16
| | | | | | | | | | | | | | | | | | | | failed because the explicitly-specified template arguments did not match its template parameters, e.g., test/SemaTemplate/overload-candidates.cpp:18:8: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'I' void get(const T&); ^ test/SemaTemplate/overload-candidates.cpp:20:8: note: candidate template ignored: invalid explicitly-specified argument for 1st template parameter void get(const T&); ^ llvm-svn: 103344
* When printing a non-viable overload candidate that failed due toDouglas Gregor2010-05-081-0/+8
conflicting deduced template argument values, give a more specific reason along with those values, e.g., test/SemaTemplate/overload-candidates.cpp:4:10: note: candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'long') const T& min(const T&, const T&); ^ llvm-svn: 103339
OpenPOWER on IntegriCloud