diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-06-06 16:00:50 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-06-06 16:00:50 +0000 |
commit | 07f7991f30a1bac95152c59ce3f780bdd84404b4 (patch) | |
tree | 667363e0a5c1adbcab170d12083f3115521f7ce2 /clang/lib/Sema/SemaTemplate.cpp | |
parent | 75f5cf657eb8036bcd2d49df9933568e6fa3df43 (diff) | |
download | bcm5719-llvm-07f7991f30a1bac95152c59ce3f780bdd84404b4.tar.gz bcm5719-llvm-07f7991f30a1bac95152c59ce3f780bdd84404b4.zip |
PR14841: If partial substitution of explicitly-specified template arguments
results in a template having too many arguments, but all the trailing arguments
are packs, that's OK if we have a partial pack substitution: the trailing pack
expansions may end up empty.
llvm-svn: 210350
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index d893c881103..d6ea3d0e2ed 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -3856,6 +3856,17 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, ++ArgIdx; } + // If we're performing a partial argument substitution, allow any trailing + // pack expansions; they might be empty. This can happen even if + // PartialTemplateArgs is false (the list of arguments is complete but + // still dependent). + if (ArgIdx < NumArgs && CurrentInstantiationScope && + CurrentInstantiationScope->getPartiallySubstitutedPack()) { + while (ArgIdx < NumArgs && + TemplateArgs[ArgIdx].getArgument().isPackExpansion()) + Converted.push_back(TemplateArgs[ArgIdx++].getArgument()); + } + // If we have any leftover arguments, then there were too many arguments. // Complain and fail. if (ArgIdx < NumArgs) |