diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-01-04 02:33:52 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-01-04 02:33:52 +0000 |
commit | b95cc97b2023d00cd3fbae8455bc9d728eab5e5d (patch) | |
tree | 00c400e5f9784666b2dc81803d30c8d86732d1ae | |
parent | 3fb9e4b89f72823f162096086f0f964e6dcf66d6 (diff) |
When creating the injected-class-name for a class template involving a
non-type template parameter pack, make sure to create a pack expansion
for the corresponding template argument.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122799 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/DeclTemplate.cpp | 6 | ||||
-rw-r--r-- | test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp index dff956c6dc..0110e3b180 100644 --- a/lib/AST/DeclTemplate.cpp +++ b/lib/AST/DeclTemplate.cpp @@ -14,6 +14,7 @@ #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/Expr.h" +#include "clang/AST/ExprCXX.h" #include "clang/AST/ASTContext.h" #include "clang/AST/TypeLoc.h" #include "clang/AST/ASTMutationListener.h" @@ -327,7 +328,10 @@ ClassTemplateDecl::getInjectedClassNameSpecialization() { NTTP->getType().getNonLValueExprType(Context), Expr::getValueKindForType(NTTP->getType()), NTTP->getLocation()); - // FIXME: Variadic templates. + + if (NTTP->isParameterPack()) + E = new (Context) PackExpansionExpr(Context.DependentTy, E, + NTTP->getLocation()); Arg = TemplateArgument(E); } else { TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*Param); diff --git a/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp b/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp index 69f6b46c28..47b7793da0 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp @@ -106,8 +106,6 @@ namespace Math { int check3[sum<1, 2, 3, 4, 5>::value == 15? 1 : -1]; -#if 0 - // FIXME: Instantiation of this fails. template<int ... Values> struct lazy_sum { int operator()() { @@ -118,7 +116,6 @@ namespace Math { void f() { lazy_sum<1, 2, 3, 4, 5>()(); } -#endif } namespace Indices { |