PR21536: Fix a corner case where we'd get confused by a pack expanding into the
penultimate parameter of a template parameter list, where the last parameter is
itself a pack, and build a bogus empty final pack argument.
llvm-svn: 221748
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 1bddfe2..50a4298 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -3749,7 +3749,7 @@
}
// Push the argument pack onto the list of converted arguments.
- if (InFinalParameterPack) {
+ if (InFinalParameterPack && !ArgumentPack.empty()) {
Converted.push_back(
TemplateArgument::CreatePackCopy(Context,
ArgumentPack.data(),