]> granicus.if.org Git - clang/commitdiff
When creating the injected-class-name for a class template involving a
authorDouglas Gregor <dgregor@apple.com>
Tue, 4 Jan 2011 02:33:52 +0000 (02:33 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 4 Jan 2011 02:33:52 +0000 (02:33 +0000)
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

lib/AST/DeclTemplate.cpp
test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp

index dff956c6dceb40cb94d6b9aff18ea7c561862d9f..0110e3b180c69495b7cc3312da05a1baa8b5d44f 100644 (file)
@@ -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);
index 69f6b46c2816ad65da294567047b5c313f7f9aec..47b7793da03f17252599bff6e610bfd40fc1635d 100644 (file)
@@ -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 {