summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/temp/temp.fct.spec
Commit message (Collapse)AuthorAgeFilesLines
* Always deduce the lengths of contained parameter packs when deducing aRichard Smith2020-01-061-0/+31
| | | | | | | | | | | | | | | | | pack expansion. Previously, if all parameter / argument pairs for a pack expansion deduction were non-deduced contexts, we would not deduce the arity of the pack, and could end up deducing a different arity (leading to failures during substitution) or defaulting to an arity of 0 (leading to bad diagnostics about passing the wrong number of arguments to a variadic function). Instead, we now always deduce the arity for all involved packs any time we deduce a pack expansion. This will result in less substitution happening in some cases, which could avoid non-SFINAEable errors, and should generally improve the quality of diagnostics when passing initializer lists to variadic functions.
* [c++20] Add rewriting from comparison operators to <=> / ==.Richard Smith2019-10-191-0/+34
| | | | | | | | | | | | | | | | | This adds support for rewriting <, >, <=, and >= to a normal or reversed call to operator<=>, for rewriting != to a normal or reversed call to operator==, and for rewriting <=> and == to reversed forms of those same operators. Note that this is a breaking change for various C++17 code patterns, including some in use in LLVM. The most common patterns (where an operator== becomes ambiguous with a reversed form of itself) are still accepted under this patch, as an extension (with a warning). I'm hopeful that we can get the language rules fixed before C++20 ships, and the extension warning is aimed primarily at providing data to inform that decision. llvm-svn: 375306
* PR38136: improve handling of template argument deduction of non-trailingRichard Smith2018-07-122-2/+54
| | | | | | | | | | | | | | | | | | | | | function parameter packs. This makes our handling of non-trailing function parameter packs consistent between the case of deduction at the top level in a function call and other cases where deduction encounters a non-trailing function parameter pack. Instead of treating a non-trailing pack and all later parameters as being non-deduced, we treat a non-trailing pack as exactly matching any explicitly-specified template arguments (or being an empty pack if there are no such arguments). This corresponds to the "never deduced" rule in [temp.deduct.call]p1, but generalized to all deduction contexts. Non-trailing template argument packs still result in the entire template argument list being treated as non-deduced, as specified in [temp.deduct.type]p9. llvm-svn: 336962
* Add tests for function conversions in conversion function templateRichard Smith2018-07-121-0/+17
| | | | | | deduction. llvm-svn: 336931
* Fix deduction for conversion function templates converting to referenceRichard Smith2018-07-111-0/+68
| | | | | | | | | | | | | | | | | | | types. We previously tried to use the "parameter is a reference" logic here, but that doesn't work because it gets P and A backwards. Instead, add a separate implementation of the "deduced A can be less qualified than A" rule. This also exposes that we incorrectly stripped cv-qualifiers from the referent of A if it was a reference. However, if we don't do that, we get the wrong results when P is a reference. In an attempt to match what sanity dictates and what other implementations are doing, we now remove cv-qualifiers from A and P unless both are reference types. I've brought this up on the core reflector too, to try to get the standard fixed. llvm-svn: 336867
* Fix determination of whether one set of cvr-qualifiers is compatibleRichard Smith2018-07-111-0/+10
| | | | | | | | | | with another in template argument deduction. We happened to typically get away with getting this wrong, because the cases where we'd produce a bogus deduction were caught by the final "deduced A is compatible with A" check. llvm-svn: 336852
* [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
* DR1315: a non-type template argument in a partial specialization is permittedRichard Smith2016-12-281-1/+1
| | | | | | | | | | 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
* When merging two deduced non-type template arguments for the same parameter,Richard Smith2016-12-231-1/+4
| | | | | | | | | | | | | | | | | | | fail the merge if the arguments have different types (except if one of them was deduced from an array bound, in which case take the type from the other). This is correct because (except in the array bound case) the type of the template argument in each deduction must match the type of the parameter, so at least one of the two deduced arguments must have a mismatched type. This is necessary because we would otherwise lose the type information for the discarded template argument in the merge, and fail to diagnose the mismatch. In order to power this, we now properly retain the type of a deduced non-type template argument deduced from a declaration, rather than giving it the type of the template parameter; we'll convert it to the template parameter type when checking the deduced arguments. llvm-svn: 290399
* [c++1z] P0012R1: Implement a few remaining pieces: downgrade diagnostic forRichard Smith2016-10-222-5/+33
| | | | | | | | | | | | | | 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-162-1/+69
| | | | | | | implements the bulk of the change (modifying the type system to include exception specifications), but not all the details just yet. llvm-svn: 284337
* Extend this test and make it a bit clearer which cases Clang is getting wrong.Richard Smith2016-10-161-14/+34
| | | | llvm-svn: 284331
* [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
* Lit C++11 Compatibility Patch #8Charles Li2016-04-141-4/+17
| | | | | | 24 tests have been updated for C++11 compatibility. llvm-svn: 266387
* Ensure that we substitute into the declaration of a template parameter packRichard Smith2016-02-031-0/+22
| | | | | | | (that is not a pack expansion) during template argument deduction, even if we deduced that the pack would be empty. llvm-svn: 259688
* Improve diagnostic for the case where a function template candidate is rejectedRichard Smith2015-12-312-2/+2
| | | | | | | | 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
* [Lit Test] Updated 26 Lit tests to be C++11 compatible.Charles Li2015-11-111-3/+16
| | | | | | | Expected diagnostics have been expanded to vary by C++ dialect. RUN line has also been expanded to: default, C++98/03 and C++11. llvm-svn: 252785
* Replace "can not" with "cannot" in diagnostics messages.Ismail Pazarbasi2014-03-071-1/+1
| | | | llvm-svn: 203302
* 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
* Once we've collected the template arguments for aDouglas Gregor2013-01-181-0/+21
| | | | | | | | partially-substituted parameter pack in a template, forget about the partially-substituted parameter pack: it is now completed. Fixes <rdar://problem/12176336>. llvm-svn: 172859
* Fix http://stackoverflow.com/questions/13521163Richard Smith2012-12-061-0/+13
| | | | | | | | | | | Don't require that, during template deduction, a template specialization type as a function parameter has at least as many template arguments as one used in a function argument (not even if the argument has been resolved to an exact type); the additional parameters might be provided by default template arguments in the template. We don't need this check, since we now implement [temp.deduct.call]p4 with an additional check after deduction. llvm-svn: 169475
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-1916-0/+16
| | | | | | 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-1314-14/+14
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* Catch placeholder types in DefaultLvalueConversionJohn McCall2011-10-111-3/+3
| | | | | | | | | | | and DefaultFunctionArrayLvalueConversion. To prevent significant regression for should-this-be-a-call fixits, and to repair some such regression from the introduction of bound member placeholders, make those placeholder checks try to build calls appropriately. Harden the build-a-call logic while we're at it. llvm-svn: 141738
* 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
* Implement CWG1170, which makes access-control errors into templateDouglas Gregor2011-05-111-0/+41
| | | | | | | argument deduction failures. Only implemented in C++0x, since this is a significant change in behavior from C++98/03. llvm-svn: 131209
* Clean up our handling of template-ids that resolve down to a singleDouglas Gregor2011-03-161-3/+3
| | | | | | | | | overload, so that we actually do the resolution for full expressions and emit more consistent, useful diagnostics. Also fixes an IRGen crasher, where Sema wouldn't diagnose a resolvable bound member function template-id used in a full-expression (<rdar://problem/9108698>). llvm-svn: 127747
* 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
* Rvalue references for *this: tentative parsing and template argument deduction.Douglas Gregor2011-01-261-0/+47
| | | | llvm-svn: 124295
* Implement the rvalue-reference deduction transformation (from T&& ->Douglas Gregor2011-01-251-0/+4
| | | | | | | | T) when taking the address of an overloaded function or matching a specialization to a template (C++0x [temp.deduct.type]p10). Fixes PR9044. llvm-svn: 124197
* Implement core issue 1164, which concerns the partial ordering ofDouglas Gregor2011-01-211-0/+10
| | | | | | f(T&) and f(T&&). llvm-svn: 123981
* 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
* Explicitly track the number of call arguments provided when performingDouglas Gregor2011-01-191-0/+14
| | | | | | | overload resolution, so that we only use that number of call arguments for partial ordering. Fixes PR9006, a recent regression. llvm-svn: 123861
* Implement partial ordering of class template partial specializationsDouglas Gregor2011-01-112-0/+41
| | | | | | | | | | | | | | | | | | | | | | and function templates that contain variadic templates. This involves three small-ish changes: (1) When transforming a pack expansion, if the transformed argument still contains unexpanded parameter packs, build a pack expansion. This can happen during the substitution that occurs into class template partial specialiation template arguments during partial ordering. (2) When performing template argument deduction where the argument is a pack expansion, match against the pattern of that pack expansion. (3) When performing template argument deduction against a non-pack parameter, or a non-expansion template argument, deduction fails if the argument itself is a pack expansion (C++0x [temp.deduct.type]p22). llvm-svn: 123279
* Add another test for [temp.func.order]p5/[temp.deduct.partial]p11,Douglas Gregor2011-01-111-0/+11
| | | | | | from James Widman. llvm-svn: 123245
* Implement C++ [temp.func.order]p5 more directly, by passing down theDouglas Gregor2011-01-111-3/+3
| | | | | | | | | number of explicit call arguments. This actually fixes an erroneous test for [temp.deduct.partial]p11, where we were considering parameters corresponding to arguments beyond those that were explicitly provided. llvm-svn: 123244
* Add example from C++0x [temp.deduct.type]p21, which already worksDouglas Gregor2011-01-111-0/+31
| | | | llvm-svn: 123237
* 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-112-0/+37
| | | | | | | | | 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 more of C++0x [temp.arg.explicit]p9, allowing extension ofDouglas Gregor2011-01-101-0/+23
| | | | | | | | | pack expansions in template argument lists and function parameter lists. The implementation of this paragraph should be complete *except* for cases where we're substituting into one of the unexpanded packs in a pack expansion; that's a general issue I haven't solved yet. llvm-svn: 123188
OpenPOWER on IntegriCloud