Implement name mangling for sizeof...(function parameter pack).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134974 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp
index 5a1025f..5b247f2 100644
--- a/lib/AST/ItaniumMangle.cpp
+++ b/lib/AST/ItaniumMangle.cpp
@@ -2669,15 +2669,8 @@
     else if (const TemplateTemplateParmDecl *TempTP
                                     = dyn_cast<TemplateTemplateParmDecl>(Pack))
       mangleTemplateParameter(TempTP->getIndex());
-    else {
-      // Note: proposed by Mike Herrick on 11/30/10
-      // <expression> ::= sZ <function-param>  # size of function parameter pack
-      Diagnostic &Diags = Context.getDiags();
-      unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error,
-                            "cannot mangle sizeof...(function parameter pack)");
-      Diags.Report(DiagID);
-      return;
-    }
+    else
+      mangleFunctionParam(cast<ParmVarDecl>(Pack));
     break;
   }
       
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index 0f4e5c5..0b3ba63 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -839,3 +839,13 @@
   // CHECK: define weak_odr void @_ZN6test352f1INS_1AEEEvDTszadsrT_plIiEE
   template void f1<A>(__SIZE_TYPE__);
 }
+
+namespace test36 {
+  template<unsigned> struct A { };
+
+  template<typename ...Types>
+  auto f1(Types... values) -> A<sizeof...(values)> { }
+
+  // CHECK: define weak_odr {{.*}} @_ZN6test362f1IJifEEENS_1AIXsZfp_EEEDpT_
+  template A<2> f1(int, float);
+}