diff options
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 3 | ||||
-rw-r--r-- | test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp | 16 |
2 files changed, 18 insertions, 1 deletions
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<int Values> struct X1nt; // expected-error{{non-type template parameter template<template<class T> class> class X1tt; // expected-note{{previous template template parameter declared here}} template<template<class T> 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<typename ...> struct tuple { }; + template<int ...> struct int_tuple { }; + + template<typename T> + struct X { + template<typename ...Args1, int ...Indices1> + X(tuple<Args1...>, int_tuple<Indices1...>); + }; + + template<typename T> + template<typename ...Args1, int ...Indices1> + X<T>::X(tuple<Args1...>, int_tuple<Indices1...>) {} +} |