aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-12-20 22:48:17 +0000
committerDouglas Gregor <dgregor@apple.com>2010-12-20 22:48:17 +0000
commit984a58b6c6892671c88e112ce449b1da3f7de4ba (patch)
tree2eb8248a8f436fed3c622fcb91542edff74338b7 /lib/Sema/SemaTemplateInstantiate.cpp
parent88f30dee6ca6d99e46d4ce61f691fb3dff4ae7c8 (diff)
Handle instantiation of template type parameter packs that occur as
the first qualifier in scope. We can't adequately test this test, unfortunately. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 4c1b3807f7..95ccae28f5 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -782,9 +782,25 @@ TemplateInstantiator::TransformFirstQualifierInScope(NamedDecl *D,
if (TemplateTypeParmDecl *TTPD = dyn_cast_or_null<TemplateTypeParmDecl>(D)) {
const TemplateTypeParmType *TTP
= cast<TemplateTypeParmType>(getSema().Context.getTypeDeclType(TTPD));
+
if (TTP->getDepth() < TemplateArgs.getNumLevels()) {
- // FIXME: Variadic templates index substitution.
- QualType T = TemplateArgs(TTP->getDepth(), TTP->getIndex()).getAsType();
+ // FIXME: This needs testing w/ member access expressions.
+ TemplateArgument Arg = TemplateArgs(TTP->getDepth(), TTP->getIndex());
+
+ if (TTP->isParameterPack()) {
+ assert(Arg.getKind() == TemplateArgument::Pack &&
+ "Missing argument pack");
+
+ if (getSema().ArgumentPackSubstitutionIndex == -1) {
+ // FIXME: Variadic templates fun case.
+ getSema().Diag(Loc, diag::err_pack_expansion_mismatch_unsupported);
+ return 0;
+ }
+
+ Arg = Arg.pack_begin()[getSema().ArgumentPackSubstitutionIndex];
+ }
+
+ QualType T = Arg.getAsType();
if (T.isNull())
return cast_or_null<NamedDecl>(TransformDecl(Loc, D));