summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaTemplate.cpp2
-rw-r--r--test/SemaTemplate/deduction.cpp18
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 63581a44db..5596a0162b 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -3746,7 +3746,7 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template,
}
// Push the argument pack onto the list of converted arguments.
- if (InFinalParameterPack) {
+ if (InFinalParameterPack && !ArgumentPack.empty()) {
Converted.push_back(
TemplateArgument::CreatePackCopy(Context,
ArgumentPack.data(),
diff --git a/test/SemaTemplate/deduction.cpp b/test/SemaTemplate/deduction.cpp
index aecb5ee7c8..c089573a9c 100644
--- a/test/SemaTemplate/deduction.cpp
+++ b/test/SemaTemplate/deduction.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
// Template argument deduction with template template parameters.
template<typename T, template<T> class A>
@@ -162,3 +162,19 @@ namespace test14 {
foo(a);
}
}
+
+namespace PR21536 {
+ template<typename ...T> struct X;
+ template<typename A, typename ...B> struct S {
+ static_assert(sizeof...(B) == 1, "");
+ void f() {
+ using T = A;
+ using T = int;
+
+ using U = X<B...>;
+ using U = X<int>;
+ }
+ };
+ template<typename ...T> void f(S<T...>);
+ void g() { f(S<int, int>()); }
+}