[cfe-commits] r122799 - in /cfe/trunk: lib/AST/DeclTemplate.cpp test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp

Douglas Gregor dgregor at apple.com
Mon Jan 3 18:33:52 PST 2011


Author: dgregor
Date: Mon Jan  3 20:33:52 2011
New Revision: 122799

URL: http://llvm.org/viewvc/llvm-project?rev=122799&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/AST/DeclTemplate.cpp
    cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp

Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=122799&r1=122798&r2=122799&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Mon Jan  3 20:33:52 2011
@@ -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 @@
                                   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);

Modified: cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp?rev=122799&r1=122798&r2=122799&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp Mon Jan  3 20:33:52 2011
@@ -106,8 +106,6 @@
 
   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 @@
   void f() {
     lazy_sum<1, 2, 3, 4, 5>()();
   }
-#endif
 }
 
 namespace Indices {





More information about the cfe-commits mailing list