summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call
Commit message (Collapse)AuthorAgeFilesLines
* [c++1z] Support deducing B in noexcept(B).Richard Smith2017-06-071-4/+5
| | | | | | | | This is not required by the standard (yet), but there seems to be reasonable support for this being a defect according to CWG discussion, and libstdc++ 7.1 relies on it working. llvm-svn: 304946
* [c++1z] Add some more tests for class template argument deduction, addRichard Smith2017-02-141-0/+17
| | | | | | feature-test macro, and mark feature as done on status page. llvm-svn: 295011
* [c++1z] Synthesize implicit deduction guides from constructors on demand. RankRichard Smith2017-02-141-3/+33
| | | | | | | | | | | | | | | | | | | such guides below explicit ones, and ensure that references to the class's template parameters are not treated as forwarding references. We make a few tweaks to the wording in the current standard: 1) The constructor parameter list is copied faithfully to the deduction guide, without losing default arguments or a varargs ellipsis (which the standard wording loses by omission). 2) If the class template declares no constructors, we add a T() -> T<...> guide (which will only ever work if T has default arguments for all non-pack template parameters). 3) If the class template declares nothing that looks like a copy or move constructor, we add a T(T<...>) -> T<...> guide. #2 and #3 follow from the "pretend we had a class type with these constructors" philosophy for deduction guides. llvm-svn: 295007
* Implement DR1388 (wg21.link/cwg1388).Richard Smith2017-01-091-5/+8
| | | | | | | | | | | | This issue clarifies how deduction proceeds past a non-trailing function parameter pack. Essentially, the pack itself is skipped and consumes no arguments (except for those implied by an explicitly-specified template arguments), and nothing is deduced from it. As a small fix to the standard's rule, we do not allow subsequent deduction to change the length of the function parameter pack (by preventing extension of the explicitly-specified pack if present, and otherwise deducing all contained packs to empty packs). llvm-svn: 291425
* [c++1z] P0012R1: Implement a few remaining pieces: downgrade diagnostic forRichard Smith2016-10-221-3/+13
| | | | | | | | | | | | | | 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-1/+26
| | | | | | | implements the bulk of the change (modifying the type system to include exception specifications), but not all the details just yet. llvm-svn: 284337
* [Sema] Disallow ambigious base classes in template argument deductionErik Pilkington2016-06-281-0/+13
| | | | | | | | Fixes PR28195. Differential revision: http://reviews.llvm.org/D21653 llvm-svn: 274077
* When deducing template parameters from base classes of an argument type, don'tRichard Smith2016-04-251-0/+14
| | | | | | | preserve any deduced types from a failed deduction to a subsequent attempt at deduction. Patch by Erik Pilkington! llvm-svn: 267444
* Improve diagnostic for the case where a function template candidate is rejectedRichard Smith2015-12-311-1/+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 quotation marks to template names in diagnostics.David Blaikie2013-03-051-0/+18
| | | | llvm-svn: 176474
* Improve 'failed template argument deduction' diagnostic for the case where weRichard Smith2013-01-312-3/+3
| | | | | | | | have a direct mismatch between some component of the template and some component of the argument. The diagnostic now says what the mismatch was, but doesn't yet say which part of the template doesn't match. llvm-svn: 174039
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-192-0/+2
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* C++11 [temp.deduct.call]p6 tweak: when given a set of overlaodedDouglas Gregor2012-03-121-1/+16
| | | | | | | | | functions that includes an explicit template argument list, perform an inner deduction against each of the function templates in that list and, if successful, use the result of that deduction for the outer template argument deduction. Fixes PR11713. llvm-svn: 152575
* When template argument deduction is ignoring qualifiers, perform deepDouglas Gregor2012-03-111-0/+8
| | | | | | | | structural comparison of non-dependent types. Otherwise, we end up rejecting cases where the non-dependent types don't match due to qualifiers in, e.g., a pointee type. Fixes PR12132. llvm-svn: 152529
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-132-2/+2
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* Per the note in C++0x [temp.deduct.call]p4, don't attempt templateDouglas Gregor2011-10-091-0/+12
| | | | | | | argument deduction against a function parameter that has no deducible template parameters in it. Fixes PR8598. llvm-svn: 141517
* Accept no-return stripping conversions for pointer type arguments afterChandler Carruth2011-06-181-1/+15
| | | | | | | | | | | | | | | | | | | deducing template parameter types. Recently Clang began enforcing the more strict checking that the argument type and the deduced function parameter type (after substitution) match, but that only consideres qualification conversions. One problem with this patch is that we check noreturn conversions and qualification conversions independently. If a valid conversion would require *both*, perhaps interleaved with each other, it will be rejected. If this actually occurs (I'm not yet sure it does) and is in fact a problem (I'm not yet sure it is), there is a FIXME to implement more intelligent conversion checking. However, this step at least allows Clang to resume accepting valid code we're seeing in the wild. llvm-svn: 133327
* Implement the consistency checking for C++ [temp.deduct.call]p3, whichDouglas Gregor2011-06-161-0/+9
| | | | | | | | | | | | | | | checks that the deduced argument type for a function call matches the actual argument type provided. The only place we've found where the consistency checking should actually cause template argument deduction failure is due to qualifier differences that don't fall into the realm of qualification conversions (which are *not* checked when we initially perform deduction). However, we're performing the full checking as specified in the standard to ensure that no other cases exist. Fixes PR9233 / <rdar://problem/9039590>. llvm-svn: 133163
* When printing a qualified type, look through a substituted templateDouglas Gregor2011-02-171-3/+3
| | | | | | | | | | parameter type to see what's behind it, so that we don't end up printing silly things like "float const *" when "const float *" would make more sense. Also, replace the pile of "isa" tests with a simple switch enumerating all of the cases, making a few more obvious cases use prefix qualifiers. llvm-svn: 125729
* More testing to C++0x [temp.deduct.call]p3Douglas Gregor2011-01-211-0/+22
| | | | llvm-svn: 123967
* Implement the special template argument deduction rule for T&& in aDouglas Gregor2011-01-211-0/+24
| | | | | | | | | | | call (C++0x [temp.deduct.call]p3). As part of this, start improving the reference-binding implementation used in the computation of implicit conversion sequences (for overload resolution) to reflect C++0x semantics. It still needs more work and testing, of course. llvm-svn: 123966
* When mapping from a function parameter pack to the set of functionDouglas Gregor2011-01-111-3/+0
| | | | | | | | | parameters it expanded to, map exactly the number of function parameters that were expanded rather than just running to the end of the instantiated parameter list. This finishes the implementation of the last sentence of C++0x [temp.deduct.call]p1. llvm-svn: 123213
* Implement the last bullet of [temp.deduct.type]p5 and part of the lastDouglas Gregor2011-01-111-0/+15
| | | | | | | | | sentence of [temp.deduct.call]p1, both of which concern the non-deducibility of parameter packs not at the end of a parameter-type-list. The latter isn't fully implemented yet; see the new FIXME. llvm-svn: 123210
* Implement template argument deduction from a call to a functionDouglas Gregor2011-01-061-0/+76
| | | | | | | | | | | | template whose last parameter is a parameter pack. This allows us to form a call to, e.g., template<typename ...Args1, typename ...Args2> void f(std::pair<Args1, Args2> ...pairs); given zero or more instances of "pair". llvm-svn: 122973
* When performing template argument deduction against a template-id,Douglas Gregor2010-11-021-0/+22
| | | | | | | only keep deduction results for successful deductions, so that they can be compared against each other. Fixes PR8462, from Richard Smith! llvm-svn: 117983
* Perform the function-to-pointer adjustment during template argumentDouglas Gregor2010-08-301-0/+18
| | | | | | | | | deduction where the parameter is a function reference, function pointer, or member function pointer and the argument is an overloaded function. Fixes <rdar://problem/8360106>, a template argument deduction issue found by Boost.Filesystem. llvm-svn: 112523
* When printing a non-viable overload candidate that failed due toDouglas Gregor2010-05-082-2/+3
| | | | | | | | | | | | 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
* FIXME complete.John McCall2010-02-021-1/+0
| | | | llvm-svn: 95059
* Improve the diagnostic used when an incompatible overload set is passedJohn McCall2010-02-021-1/+1
| | | | | | as an argument during overload resolution. llvm-svn: 95057
* Implement C++ [temp.deduct.call]p6, template argument deduction for overloadedJohn McCall2010-02-021-0/+96
| | | | | | | | | | arguments. Fix a bug where incomplete explicit specializations were being passed through as legitimate. Fix a bug where the absence of an explicit specialization in an overload set was causing overall deduction to fail. Fixes PR6191. llvm-svn: 95052
* Note that an overload candidate was non-viable because template argumentJohn McCall2010-02-011-1/+2
| | | | | | | deduction failed. Right now there's a very vague diagnostic for most cases and a good diagnostic for incomplete deduction. llvm-svn: 94988
* Add test from PR5913, which has already been fixedDouglas Gregor2010-01-061-0/+13
| | | | llvm-svn: 92863
* Make sure to use ASTContext::getAs*ArrayType() when decomposing arrayDouglas Gregor2010-01-041-0/+2
| | | | | | types. Fixes APFloat.cpp compilation failure. llvm-svn: 92523
* Introduce a centralized routine in Sema for diagnosing failed lookups (whenJohn McCall2009-12-161-1/+1
| | | | | | | | | used as expressions). In dependent contexts, try to recover by doing a lookup in previously-dependent base classes. We get better diagnostics out, but unfortunately the recovery fails: we need to turn it into a method call expression, not a bare call expression. Thus this is still a WIP. llvm-svn: 91525
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-153-3/+3
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Improve template argument deduction in the case where the parameterDouglas Gregor2009-09-301-1/+3
| | | | | | | | | type is a template-id (e.g., basic_ostream<CharT, Traits>) and the argument type is a class that has a derived class matching the parameter type. Previously, we were giving up on template argument deduction too early. llvm-svn: 83177
* Improve template argument deduction from a call. In particular,Douglas Gregor2009-07-071-2/+28
| | | | | | | | implement C++ [temp.deduct.call]p3b3, which allows a template-id parameter to match a derived class of the argument, while deducing template arguments. llvm-svn: 74965
* During template argument deduction from a function call, allowDouglas Gregor2009-06-261-1/+10
| | | | | | | | deduction from pointer and pointer-to-member types to work even in the presence of a qualification conversion (C++ [temp.deduct.type]p3 bullet 2). llvm-svn: 74354
* A little template argument deduction test uncovered an "oops". As partDouglas Gregor2009-06-261-0/+7
| | | | | | | | | | of template instantiation, we were dropping cv-qualifiers on the instantiated type in a few places. This change reshuffles the type-instantiation code a little bit so that there's a single place where we add qualifiers to the instantiated type, so that we won't end up with this same bug in the future. llvm-svn: 74331
* Template argument deduction is no longer responsible for checkingDouglas Gregor2009-06-261-1/+18
| | | | | | | | | | | | | non-dependent parameter types. Instead, class template partial specializations perform a final check of all of the instantiated arguments. This model is cleaner, and works better for function templates where the "final check" occurs during overload resolution. Also, cope with cv-qualifiers when the parameter type was originally a reference type, so that the deduced argument can be more qualified than the transformed argument. llvm-svn: 74323
* Improve template argument deduction for reference parameters whenDouglas Gregor2009-06-262-0/+75
| | | | | | | deducing template arguments from a function call. Plus, add a bunch of tests. llvm-svn: 74301
* Improved semantic analysis and AST respresentation for functionDouglas Gregor2009-06-251-0/+11
templates. For example, this now type-checks (but does not instantiate the body of deref<int>): template<typename T> T& deref(T* t) { return *t; } void test(int *ip) { int &ir = deref(ip); } Specific changes/additions: * Template argument deduction from a call to a function template. * Instantiation of a function template specializations (just the declarations) from the template arguments deduced from a call. * FunctionTemplateDecls are stored directly in declaration contexts and found via name lookup (all forms), rather than finding the FunctionDecl and then realizing it is a template. This is responsible for most of the churn, since some of the core declaration matching and lookup code assumes that all functions are FunctionDecls. llvm-svn: 74213
OpenPOWER on IntegriCloud