r186728 - Fix pack instantiation with function types.

Eli Friedman eli.friedman at gmail.com
Fri Jul 19 15:50:29 PDT 2013


Author: efriedma
Date: Fri Jul 19 17:50:29 2013
New Revision: 186728

URL: http://llvm.org/viewvc/llvm-project?rev=186728&view=rev
Log:
Fix pack instantiation with function types.

Make sure we correctly expand packs which expand to another
pack in a function type.

Modified:
    cfe/trunk/lib/Sema/TreeTransform.h
    cfe/trunk/test/SemaTemplate/alias-templates.cpp

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=186728&r1=186727&r2=186728&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Fri Jul 19 17:50:29 2013
@@ -4269,6 +4269,10 @@ bool TreeTransform<Derived>::
           if (NewType.isNull())
             return true;
 
+          if (NewType->containsUnexpandedParameterPack())
+            NewType = getSema().Context.getPackExpansionType(NewType,
+                                                             NumExpansions);
+
           OutParamTypes.push_back(NewType);
           if (PVars)
             PVars->push_back(0);

Modified: cfe/trunk/test/SemaTemplate/alias-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/alias-templates.cpp?rev=186728&r1=186727&r2=186728&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/alias-templates.cpp (original)
+++ cfe/trunk/test/SemaTemplate/alias-templates.cpp Fri Jul 19 17:50:29 2013
@@ -189,3 +189,10 @@ namespace PR16646 {
     }
   }
 }
+
+namespace VariadicAliasWithFunctionType {
+  template <class T> struct A { };
+  template <class ...Args> using B = A<int(Args ...x)>;
+  template <class ...Args> void f(B<A<int>, A<Args>...>) {}
+  void g() { f(A<int(A<int>,A<int>)>()); }
+}





More information about the cfe-commits mailing list