From: Douglas Gregor Date: Thu, 13 Jan 2011 18:47:47 +0000 (+0000) Subject: Only apply the parameter pack matching of C++0x [temp.arg.template]p3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c421f546e63b2f85caa1ca0d94d508f99bb871cb;p=clang Only apply the parameter pack matching of C++0x [temp.arg.template]p3 when we're actually matching a template template argument to a template template parameter. Otherwise, use strict matching. Fixes clang++: variadics and out-of-line definitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123385 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 08384ccef5..868458c2a9 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -3801,7 +3801,8 @@ Sema::TemplateParameterListsAreEqual(TemplateParameterList *New, for (TemplateParameterList::iterator OldParm = Old->begin(), OldParmEnd = Old->end(); OldParm != OldParmEnd; ++OldParm) { - if (!(*OldParm)->isTemplateParameterPack()) { + if (Kind != TPL_TemplateTemplateArgumentMatch || + !(*OldParm)->isTemplateParameterPack()) { if (NewParm == NewParmEnd) { if (Complain) DiagnoseTemplateParameterListArityMismatch(*this, New, Old, Kind, diff --git a/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp b/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp index 3fc774cbfa..989ff9f6d9 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp @@ -25,3 +25,19 @@ template struct X1nt; // expected-error{{non-type template parameter template class> class X1tt; // expected-note{{previous template template parameter declared here}} template class...> class X1tt; // expected-error{{template template parameter pack conflicts with previous template template parameter}} + +// Check for matching with out-of-line definitions +namespace rdar8859985 { + template struct tuple { }; + template struct int_tuple { }; + + template + struct X { + template + X(tuple, int_tuple); + }; + + template + template + X::X(tuple, int_tuple) {} +}