[cfe-commits] r122283 - /cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
Douglas Gregor
dgregor at apple.com
Mon Dec 20 14:48:17 PST 2010
Author: dgregor
Date: Mon Dec 20 16:48:17 2010
New Revision: 122283
URL: http://llvm.org/viewvc/llvm-project?rev=122283&view=rev
Log:
Handle instantiation of template type parameter packs that occur as
the first qualifier in scope. We can't adequately test this test,
unfortunately.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=122283&r1=122282&r2=122283&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Mon Dec 20 16:48:17 2010
@@ -782,9 +782,25 @@
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));
More information about the cfe-commits
mailing list