Fix pack instantiation with function types.
authorEli Friedman <eli.friedman@gmail.com>
Fri, 19 Jul 2013 22:50:29 +0000 (22:50 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 19 Jul 2013 22:50:29 +0000 (22:50 +0000)
Make sure we correctly expand packs which expand to another
pack in a function type.

llvm-svn: 186728

clang/lib/Sema/TreeTransform.h
clang/test/SemaTemplate/alias-templates.cpp

index 34fdbad..4a41b60 100644 (file)
@@ -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);
index eeb6b95..f495620 100644 (file)
@@ -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>)>()); }
+}