• Home
  • History
  • Annotate
  • only in /external/clang/test/CXX/temp/temp.fct.spec/
History log of /external/clang/test/CXX/temp/temp.fct.spec/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
4b02dff7aebb98d2d60b2ff4d3fc86109213128c 05-Mar-2013 David Blaikie <dblaikie@gmail.com> Add quotation marks to template names in diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176474 91177308-0d34-0410-b5e6-96231b3b80d8
29805ca6d278b4d9563adfee67f2478f0fecdcfc 31-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Improve 'failed template argument deduction' diagnostic for the case where we
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174039 91177308-0d34-0410-b5e6-96231b3b80d8
22eaced5cac3cf0522c953f593419fc6cf184aaf 18-Jan-2013 Douglas Gregor <dgregor@apple.com> Once we've collected the template arguments for a
partially-substituted parameter pack in a template, forget about the
partially-substituted parameter pack: it is now completed. Fixes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172859 91177308-0d34-0410-b5e6-96231b3b80d8
030a6644f253818b81b4d8a7fc1770c0a3d35474 06-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix http://stackoverflow.com/questions/13521163

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169475 91177308-0d34-0410-b5e6-96231b3b80d8
8e8fb3be5bd78f0564444eca02b404566a5f3b5d 19-Oct-2012 Andy Gibbs <andyg1001@hotmail.co.uk> Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166280 91177308-0d34-0410-b5e6-96231b3b80d8
860d9b780b54f56cd27e16620196d213385d31f7 12-Mar-2012 Douglas Gregor <dgregor@apple.com> C++11 [temp.deduct.call]p6 tweak: when given a set of overlaoded
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152575 91177308-0d34-0410-b5e6-96231b3b80d8
fc55a8290a3e81111c0a373e1a04b09dd7da0b98 11-Mar-2012 Douglas Gregor <dgregor@apple.com> When template argument deduction is ignoring qualifiers, perform deep
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152529 91177308-0d34-0410-b5e6-96231b3b80d8
762bb9d0ad20320b9f97a841dce57ba5e8e48b07 14-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Update all tests other than Driver/std.cpp to use -std=c++11 rather than
-std=c++0x. Patch by Ahmed Charles!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141900 91177308-0d34-0410-b5e6-96231b3b80d8
6dbba4fc128e2e2f5b26be996392bd32c0707f13 12-Oct-2011 John McCall <rjmccall@apple.com> Catch placeholder types in DefaultLvalueConversion
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141738 91177308-0d34-0410-b5e6-96231b3b80d8
d8f5b333f96b4e8018ff3a0d0db62d9e78eb6bdd 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Per the note in C++0x [temp.deduct.call]p4, don't attempt template
argument deduction against a function parameter that has no deducible
template parameters in it. Fixes PR8598.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141517 91177308-0d34-0410-b5e6-96231b3b80d8
18e0461ad72dcf6ec93cd3b1df7bf1b5a30b10b7 18-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Accept no-return stripping conversions for pointer type arguments after
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133327 91177308-0d34-0410-b5e6-96231b3b80d8
dbfb371e297794e827ad2e5b33b45fafbfc46b29 16-Jun-2011 Douglas Gregor <dgregor@apple.com> Implement the consistency checking for C++ [temp.deduct.call]p3, which
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

Fixes PR9233 / <rdar://problem/9039590>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133163 91177308-0d34-0410-b5e6-96231b3b80d8
7822ee3ef9f0d5cfd289258614ac31be70097449 12-May-2011 Douglas Gregor <dgregor@apple.com> Implement CWG1170, which makes access-control errors into template
argument deduction failures. Only implemented in C++0x, since this is
a significant change in behavior from C++98/03.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131209 91177308-0d34-0410-b5e6-96231b3b80d8
db2eae639d3b7ed61ceb56890b73168517ef57f1 16-Mar-2011 Douglas Gregor <dgregor@apple.com> Clean up our handling of template-ids that resolve down to a single
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>).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127747 91177308-0d34-0410-b5e6-96231b3b80d8
c6daf0b29d6c48a99cb1ad707973a7e6dfcafd58 17-Feb-2011 Douglas Gregor <dgregor@apple.com> When printing a qualified type, look through a substituted template
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125729 91177308-0d34-0410-b5e6-96231b3b80d8
e3c7a7ca66c02567543dbb5ec493818e00e8b177 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Rvalue references for *this: tentative parsing and template argument deduction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124295 91177308-0d34-0410-b5e6-96231b3b80d8
73b3cf6503f72f054288cf474e1a8c8ae56383c2 25-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the rvalue-reference deduction transformation (from T&& ->
T) when taking the address of an overloaded function or matching a
specialization to a template (C++0x [temp.deduct.type]p10). Fixes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124197 91177308-0d34-0410-b5e6-96231b3b80d8
b939a1987318f802fd25f89e15ae7d2423161cac 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement core issue 1164, which concerns the partial ordering of
f(T&) and f(T&&).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123981 91177308-0d34-0410-b5e6-96231b3b80d8
dd0e023cf8faf95eb8025a02ce6fd19ef7788216 21-Jan-2011 Douglas Gregor <dgregor@apple.com> More testing to C++0x [temp.deduct.call]p3

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123967 91177308-0d34-0410-b5e6-96231b3b80d8
2ad746aeb90e86cea7afaf552a02ae3f3b5ec859 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the special template argument deduction rule for T&& in a
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123966 91177308-0d34-0410-b5e6-96231b3b80d8
dfc331e04d4c6a09fb693a15fc5a57d29a198c86 20-Jan-2011 Douglas Gregor <dgregor@apple.com> Explicitly track the number of call arguments provided when performing
overload resolution, so that we only use that number of call arguments
for partial ordering. Fixes PR9006, a recent regression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123861 91177308-0d34-0410-b5e6-96231b3b80d8
77d6bb9e223496aa5288294f34e7225d1f65dddc 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement partial ordering of class template partial specializations
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

(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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123279 91177308-0d34-0410-b5e6-96231b3b80d8
4e97586b804f6132d83cb534f16a5b6a7756e819 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Add another test for [temp.func.order]p5/[temp.deduct.partial]p11,
from James Widman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123245 91177308-0d34-0410-b5e6-96231b3b80d8
5c7bf42ef16dc767615bed10f3b7b3c1265314e1 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement C++ [temp.func.order]p5 more directly, by passing down the
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123244 91177308-0d34-0410-b5e6-96231b3b80d8
2e996d929d2593e5131640e774d04fe433ba5f89 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Add example from C++0x [temp.deduct.type]p21, which already works

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123237 91177308-0d34-0410-b5e6-96231b3b80d8
21371ea7cf647f4f0f783faac325925cb8febb1c 11-Jan-2011 Douglas Gregor <dgregor@apple.com> When mapping from a function parameter pack to the set of function
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123213 91177308-0d34-0410-b5e6-96231b3b80d8
7d5c0c1273bdc1cb3dff1cb5a62d07b1439e82c7 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the last bullet of [temp.deduct.type]p5 and part of the last
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123210 91177308-0d34-0410-b5e6-96231b3b80d8
3cae5c9a79bfd2e27eb44c32b13dfacd2ce5c66f 10-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement more of C++0x [temp.arg.explicit]p9, allowing extension of
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123188 91177308-0d34-0410-b5e6-96231b3b80d8
d3731198193eee92796ddeb493973b7a598b003e 10-Jan-2011 Douglas Gregor <dgregor@apple.com> Work-in-progress implementation of C++0x [temp.arg.explicit]p9, which
allows an argument pack determines via explicit specification of
function template arguments to be extended by further, deduced
arguments. For example:

template<class ... Types> void f(Types ... values);
void g() {
f<int*, float*>(0, 0, 0); // Types is deduced to the sequence int*, float*, int

There are a number of FIXMEs in here that indicate places where we
need to implement + test retained expansions, plus a number of other
places in deduction where we need to correctly cope with the
explicitly-specified arguments when deducing an argument
pack. Furthermore, it appears that the RecursiveASTVisitor needs to be
auditied; it's missing some traversals (especially w.r.t. template
arguments) that cause it not to find unexpanded parameter packs when
it should.

The good news, however, is that the tr1::tuple implementation now
works fully, and the tr1::bind example (both from N2080) is actually
working now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123163 91177308-0d34-0410-b5e6-96231b3b80d8
a009b59fc2c550a229b9146aabda8e33fe3a7771 07-Jan-2011 Douglas Gregor <dgregor@apple.com> Factor out the template transformation of a sequence of function
parameters into parameter types, so that substitution of
explicitly-specified function template arguments uses the same
path. This enables the use of explicitly-specified function template
arguments with variadic templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122986 91177308-0d34-0410-b5e6-96231b3b80d8
f5c65ffbd7374b6c8d9f1e361041578640cab320 06-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement template argument deduction from a call to a function
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".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122973 91177308-0d34-0410-b5e6-96231b3b80d8
6e4e17de3df88ead7eaf51b3503a6be1718438c0 24-Dec-2010 Douglas Gregor <dgregor@apple.com> Fix a thinko in a helper routine for template argument deduction that
caused an assertion when dealing with non-type template parameter
packs. Add some tests for deduction and instantiation of non-type
template parameter packs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122534 91177308-0d34-0410-b5e6-96231b3b80d8
ea6c96f63a45b4ffdcdf9824a9cf31a32825c0f6 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement the part of C++0x [temp.arg.explicit]p3 that pertains to
parameter packs. In particular, a parameter pack not otherwise deduced
is deduced to an empty parameter pack.

The C++0x wording here is a bit unfortunate; this should really only
apply to function templates, and it mentions "trailing" parameter
packs, which doesn't really make sense in the context of function
templates. Will file a core issue separately.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122463 91177308-0d34-0410-b5e6-96231b3b80d8
7b976ece336d209977b25b5c28ee09c2d2146e6a 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement the rest of C++0x [temp.deduct.type]p9, which specifies that
the presence of a pack expansion anywhere except at the end of a
template-argument-list causes the entire template-argument-list to be
a non-deduced context.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122461 91177308-0d34-0410-b5e6-96231b3b80d8
0d80abc3b7fb0dca26fb6b272d2c3484f86fb7e7 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Unify the consistency checking for deduced template arguments into a
single routine. Extend that routine to handle consistency
checking for template argument packs, so that we can compare the
deduced packs for template parameter packs across different pack

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122452 91177308-0d34-0410-b5e6-96231b3b80d8
053105d58552c600a2e56473592212a9bddafcd4 02-Nov-2010 Douglas Gregor <dgregor@apple.com> When performing template argument deduction against a template-id,
only keep deduction results for successful deductions, so that they
can be compared against each other. Fixes PR8462, from Richard Smith!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117983 91177308-0d34-0410-b5e6-96231b3b80d8
2cd11fefb62c580651e4269e1488381c2d6d07ad 12-Oct-2010 John McCall <rjmccall@apple.com> Progress.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116287 91177308-0d34-0410-b5e6-96231b3b80d8
7e010a04fef171049291d8cb3047f118566da090 31-Aug-2010 Douglas Gregor <dgregor@apple.com> When instantiating a function type, instantiate the return type before
instantiating the parameters. In a perfect world, this wouldn't
matter, and compilers are free to instantiate in any order they
want. However, every other compiler seems to instantiate the return
type first, and some code (in this case, Boost.Polygon) depends on
this and SFINAE to avoid instantiating something that shouldn't be

We could fight this battle, and insist that Clang is allowed to do
what it does, but it's not beneficial: it's more predictable to
instantiate this way, in source order. When we implement
late-specified return types, we'll need to instantiate the return type
last when it was late-specified, hence the FIXME.

We now compile Boost.Polygon properly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112561 91177308-0d34-0410-b5e6-96231b3b80d8
75f21af57f3dce1577d6c27bbe7bb45b49ced732 30-Aug-2010 Douglas Gregor <dgregor@apple.com> Perform the function-to-pointer adjustment during template argument
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112523 91177308-0d34-0410-b5e6-96231b3b80d8
66a8c9a6b1f9bcd78779e5d414f3c9ae3cabdd93 15-Jul-2010 Douglas Gregor <dgregor@apple.com> When determining whether an overload set with explicit template
arguments only resolves to a single specialization, make sure to look
through using declarations. Fixes PR7641.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108376 91177308-0d34-0410-b5e6-96231b3b80d8
ec20f46740a59758b12c22108002395bcf5b6f9b 08-May-2010 Douglas Gregor <dgregor@apple.com> When printing an overload candidate that failed due to SFINAE, print a
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 ...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103348 91177308-0d34-0410-b5e6-96231b3b80d8
a18592ec62e898aed7ed71e1f09c314590ce9ec7 08-May-2010 Douglas Gregor <dgregor@apple.com> When template argument deduction fails because the call had too
many/too few arguments, use the same diagnostic we use for arity
mismatches in non-templates (but note that it's a function template).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103341 91177308-0d34-0410-b5e6-96231b3b80d8
a933319ebf754396623165f9dc0a29c2a48879f5 08-May-2010 Douglas Gregor <dgregor@apple.com> When printing a non-viable overload candidate that failed due to
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&);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103339 91177308-0d34-0410-b5e6-96231b3b80d8
02024a9f0d8e6c898de276193af604c42ee41269 28-Mar-2010 Douglas Gregor <dgregor@apple.com> After performing template argument deduction for a function template,
check deduced non-type template arguments and template template
arguments against the template parameters for which they were deduced,
performing conversions as appropriate so that deduced template
arguments get the same treatment as explicitly-specified template
arguments. This is the bulk of PR6723.

Also keep track of whether deduction of a non-type template argument
came from an array bound (vs. anywhere else). With this information,
we enforce C++ [temp.deduct.type]p17, which requires exact type
matches when deduction deduces a non-type template argument from
something that is not an array bound.

Finally, when in a SFINAE context, translate the "zero sized
arrays are an extension" extension diagnostic into a hard error (for
better standard conformance), which was a minor part of PR6723.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99734 91177308-0d34-0410-b5e6-96231b3b80d8
4a0bac96103ba9f1528e91a26c0be457d39cec0f 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Add tests for PR6707.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99613 91177308-0d34-0410-b5e6-96231b3b80d8
1a6e03457ebafd6ac523cdcf5d6b6f411ea08772 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Reinstate change to non-type template arguments of integral type, so
that we extend/truncate then correct the sign to convert the non-type
template argument to the template parameter's type. Previously, we
reported an error when the non-type template argument was out of
range; now we just warn.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99600 91177308-0d34-0410-b5e6-96231b3b80d8
0d4fd8ef35ecd73ce6388cb5a6fdcfb15171f5aa 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Revert attempted fix for integral template arguments. It seems to have broken tramp3d-v4.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99583 91177308-0d34-0410-b5e6-96231b3b80d8
684d096c204c5eef29c10777bce890400d235d8c 25-Mar-2010 Douglas Gregor <dgregor@apple.com> Warn when the conversion of an integral non-type template argument to
the type of its corresponding non-type template parameter changes the
value. Previously, we were diagnosing this as an error, which was
wrong. We give reasonably nice warnings like:

test/SemaTemplate/temp_arg_nontype.cpp:100:10: warning: non-type template
argument value '256' truncated to '0' for template parameter of type
'unsigned char'
Overflow<256> *overflow3; // expected-warning{{non-type template ...
test/SemaTemplate/temp_arg_nontype.cpp:96:24: note: template parameter is
declared here
template<unsigned char C> struct Overflow;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99561 91177308-0d34-0410-b5e6-96231b3b80d8
a9bff30776888977f580c9cac212fd1583ee963e 28-Feb-2010 Douglas Gregor <dgregor@apple.com> Warn about the deprecated string literal -> char* conversion. Fixes PR6428.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97404 91177308-0d34-0410-b5e6-96231b3b80d8
9ba6166f4a78722e7df8ffbd64eb788bfdf2764a 26-Feb-2010 John McCall <rjmccall@apple.com> Fix an assertion-on-error during tentative constructor parsing by
propagating error conditions out of the various annotate-me-a-snowflake
routines. Generally (but not universally) removes redundant diagnostics
as well as, you know, not crashing on bad code. On the other hand,
I have just signed myself up to fix fiddly parser errors for the next
week. Again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97221 91177308-0d34-0410-b5e6-96231b3b80d8
0519fe2e11ae60d297b50f5497761045783f79c7 02-Feb-2010 John McCall <rjmccall@apple.com> FIXME complete.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95059 91177308-0d34-0410-b5e6-96231b3b80d8
5920dbba965a2f2a963313d94be3ff3d2b67ece7 02-Feb-2010 John McCall <rjmccall@apple.com> Improve the diagnostic used when an incompatible overload set is passed
as an argument during overload resolution.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95057 91177308-0d34-0410-b5e6-96231b3b80d8
eff92135d32039c9874dc356f3e93143af6069c1 02-Feb-2010 John McCall <rjmccall@apple.com> Implement C++ [temp.deduct.call]p6, template argument deduction for overloaded
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95052 91177308-0d34-0410-b5e6-96231b3b80d8
342fec43c515184a3c0d0600323dfec2b059e74e 01-Feb-2010 John McCall <rjmccall@apple.com> Note that an overload candidate was non-viable because template argument
deduction failed. Right now there's a very vague diagnostic for most cases
and a good diagnostic for incomplete deduction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94988 91177308-0d34-0410-b5e6-96231b3b80d8
9e68871f1e99e7e1536f16d5364fd5e2a352e9c4 11-Jan-2010 Douglas Gregor <dgregor@apple.com> When resolving a single function template specialization to a
function, be sure to adjust the resulting argument type to a pointer
(if necessary). Fixes PR5910 and PR5949.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93178 91177308-0d34-0410-b5e6-96231b3b80d8
21714013498fd84a6e8d5ceb1af5d14b6531cfb5 06-Jan-2010 Douglas Gregor <dgregor@apple.com> Add test from PR5913, which has already been fixed

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92863 91177308-0d34-0410-b5e6-96231b3b80d8
442471309fa97348f849687a6a8ef4acc3bc2c1f 04-Jan-2010 Douglas Gregor <dgregor@apple.com> Make sure to use ASTContext::getAs*ArrayType() when decomposing array
types. Fixes APFloat.cpp compilation failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92523 91177308-0d34-0410-b5e6-96231b3b80d8
4b52e25f3b05ab0f9d2492276a52323a50a84fb7 22-Dec-2009 Douglas Gregor <dgregor@apple.com> When a template-id refers to a single function template, and the
explicitly-specified template arguments are enough to determine the
instantiation, and either template argument deduction fails or is not
performed in that context, we can resolve the template-id down to a
function template specialization (so sayeth C++0x
[temp.arg.explicit]p3). Fixes PR5811.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91852 91177308-0d34-0410-b5e6-96231b3b80d8
578b69b186d9cba0a6ae1dd7f4c04cd6a49f0aac 16-Dec-2009 John McCall <rjmccall@apple.com> Introduce a centralized routine in Sema for diagnosing failed lookups (when
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91525 91177308-0d34-0410-b5e6-96231b3b80d8
a5728872c7702ddd09537c95bc3cbd20e1f2fb09 15-Dec-2009 Daniel Dunbar <daniel@zuster.org> Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- 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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
4a5c15f75f76b95e1c2ceb6fa2737dcadd5f4be1 01-Oct-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction in the case where the parameter
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83177 91177308-0d34-0410-b5e6-96231b3b80d8
e73bb60de3c7c60453a86e097fc428d1cd367a42 14-Sep-2009 Douglas Gregor <dgregor@apple.com> Refactor MarkDeductedTemplateParameters into
MarkUsedTemplateParameters, which is able to mark template parameters
used within non-deduced contexts as well as deduced contexts. Use this
to finish the implementation of [temp.deduct.partial]p11.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81794 91177308-0d34-0410-b5e6-96231b3b80d8
1282029f3d37f482bbba3c38ea9da17a78d11d40 14-Sep-2009 Douglas Gregor <dgregor@apple.com> Tighten up checking of non-dependent arguments as part of template
argument deduction. This fixes the new test case (since partial
ordering does not have a "verify the results of deduction" step), and
will allow failed template argument deductions to return more quickly
for, e.g., matching class template partial specializations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81779 91177308-0d34-0410-b5e6-96231b3b80d8
d83d04041f64a2c89123d227fa8003b482391279 22-Aug-2009 Douglas Gregor <dgregor@apple.com> Implement delayed parsing for member function templates. Fixes PR4608.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79709 91177308-0d34-0410-b5e6-96231b3b80d8
65ec1fda479688d143fe2403242cd9c730c800a1 22-Aug-2009 Douglas Gregor <dgregor@apple.com> Implement conversion function templates, along with the ability to use
template argument deduction from a conversion function (C++
[temp.deduct.conv]) with implicit conversions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79693 91177308-0d34-0410-b5e6-96231b3b80d8
bc0a2226c7fcd18b29b6846049e2cfcb872d3593 27-Jul-2009 Owen Anderson <resistor@mac.com> Update for LLVM API change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77249 91177308-0d34-0410-b5e6-96231b3b80d8
83314aa1cf61ed2458a8a20c83b2d4708192d5dc 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Implement template argument deduction when taking the address of a
function template. Most of the change here is in factoring out the
common bits used for template argument deduction from a function call
and when taking the address of a function template.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75044 91177308-0d34-0410-b5e6-96231b3b80d8
de0cb8b6c15c756e14b0716bebd40f4ce48ee717 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction from a call. In particular,
implement C++ [temp.deduct.call]p3b3, which allows a template-id
parameter to match a derived class of the argument, while deducing
template arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74965 91177308-0d34-0410-b5e6-96231b3b80d8
41e8c21eb41fca41e2e065e75f01433427858c19 02-Jul-2009 Ted Kremenek <kremenek@apple.com> Fix RUN line so this test doesn't hang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74719 91177308-0d34-0410-b5e6-96231b3b80d8
cca9e9674a5e50a283185d8e9d8a5c3414eb008e 02-Jul-2009 Douglas Gregor <dgregor@apple.com> Keep track of more information within the template instantiation stack, e.g.,
by distinguishing between substitution that occurs for template
argument deduction vs. explicitly-specifiad template arguments. This
is used both to improve diagnostics and to make sure we only provide
SFINAE in those cases where SFINAE should apply.

In addition, deal with the sticky issue where SFINAE only considers
substitution of template arguments into the *type* of a function
template; we need to issue hard errors beyond this point, as
test/SemaTemplate/operator-template.cpp illustrates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74651 91177308-0d34-0410-b5e6-96231b3b80d8
16134c62ef3d146e0dd0c76aafb906ff12c0a15d 01-Jul-2009 Douglas Gregor <dgregor@apple.com> Cope with explicitly-specified function template arguments when there
are fewer template arguments than there are template parameters for
that function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74578 91177308-0d34-0410-b5e6-96231b3b80d8
6db8ed4498b83fe9336e3855a4ba1a298b04ee00 01-Jul-2009 Douglas Gregor <dgregor@apple.com> When explicit template arguments are provided for a function call,
substitute those template arguments into the function parameter types
prior to template argument deduction. There's still a bit of work to
do to make this work properly when only some of the template arguments
are specified.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74576 91177308-0d34-0410-b5e6-96231b3b80d8
edce4dd44732dfad69f28822dddcf2b8e92b4483 01-Jul-2009 Douglas Gregor <dgregor@apple.com> Preliminary parsing and ASTs for template-ids that refer to function
templates, such as make<int&>. These template-ids are only barely
functional for function calls; much more to come.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74563 91177308-0d34-0410-b5e6-96231b3b80d8
508f1c889b9833903ea394034fe0246d3a57a32d 27-Jun-2009 Douglas Gregor <dgregor@apple.com> During template argument deduction from a function call, allow
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74354 91177308-0d34-0410-b5e6-96231b3b80d8
8a5cb1196ee8491570160e36c216631df3a9e95c 26-Jun-2009 Douglas Gregor <dgregor@apple.com> A little template argument deduction test uncovered an "oops". As part
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74331 91177308-0d34-0410-b5e6-96231b3b80d8
f670c8cfa58b4c224eb8fb566130dc47844dd3de 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Template argument deduction is no longer responsible for checking
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74323 91177308-0d34-0410-b5e6-96231b3b80d8
500d331eade2f5070b66ba51d777224f9fda6e1d 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction for reference parameters when
deducing template arguments from a function call. Plus, add a bunch of

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74301 91177308-0d34-0410-b5e6-96231b3b80d8
e53060fa78ad7e98352049f72787bdb7543e2a48 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Improved semantic analysis and AST respresentation for function

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74213 91177308-0d34-0410-b5e6-96231b3b80d8