]> granicus.if.org Git - clang/commitdiff
Implement name mangling for sizeof...(function parameter pack).
authorDouglas Gregor <dgregor@apple.com>
Tue, 12 Jul 2011 07:03:48 +0000 (07:03 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 12 Jul 2011 07:03:48 +0000 (07:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134974 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ItaniumMangle.cpp
test/CodeGenCXX/mangle.cpp

index 5a1025fff024df64831dc32974b052fe81fc8d16..5b247f2cdd977ef25f8a5ec6abc91bed2d87b60f 100644 (file)
@@ -2669,15 +2669,8 @@ recurse:
     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;
   }
       
index 0f4e5c5c38259a56914722f98ca54ea771783c95..0b3ba639afd1fa3a683666bc6c8fb430c867e06b 100644 (file)
@@ -839,3 +839,13 @@ namespace test35 {
   // 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);
+}