diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-12-20 22:48:17 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-12-20 22:48:17 +0000 |
| commit | 53c3f4e8032ca980ab55ea7b172ee741b587745d (patch) | |
| tree | 1f40e18bd416a43837f79d5c3d24eebdd3c6894a /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
| parent | 9a9116ec8d25a90477e2e9db2c9e10e24a875c59 (diff) | |
| download | bcm5719-llvm-53c3f4e8032ca980ab55ea7b172ee741b587745d.tar.gz bcm5719-llvm-53c3f4e8032ca980ab55ea7b172ee741b587745d.zip | |
Handle instantiation of template type parameter packs that occur as
the first qualifier in scope. We can't adequately test this test,
unfortunately.
llvm-svn: 122283
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 4c1b3807f71..95ccae28f54 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/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)); |

