From 95a3256ad0259f0b2af2515f011ef7addf4b29a4 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Thu, 19 Feb 2015 21:41:48 +0000 Subject: [PATCH] Itanium ABI: Pack expansions change the arity of expressions to unknown git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229918 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ItaniumMangle.cpp | 11 ++++++++--- test/CodeGenCXX/mangle.cpp | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp index f4fee77925..95fca00125 100644 --- a/lib/AST/ItaniumMangle.cpp +++ b/lib/AST/ItaniumMangle.cpp @@ -2796,9 +2796,14 @@ recurse: Out << "cl"; } - mangleExpression(CE->getCallee(), CE->getNumArgs()); - for (unsigned I = 0, N = CE->getNumArgs(); I != N; ++I) - mangleExpression(CE->getArg(I)); + unsigned CallArity = CE->getNumArgs(); + for (const Expr *Arg : CE->arguments()) + if (isa(Arg)) + CallArity = UnknownArity; + + mangleExpression(CE->getCallee(), CallArity); + for (const Expr *Arg : CE->arguments()) + mangleExpression(Arg); Out << 'E'; break; } diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index 2cdfd1929a..630a251c20 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -1062,3 +1062,12 @@ namespace test51 { // CHECK-LABEL: @_ZN6test514fun7INS_1EEEEDTcldtcvS1__Esr1EEdnT_EEv template void fun8(); } + +namespace test52 { +struct X {}; +void operator+(X); +template +auto f4(T... x) -> decltype(operator+(x...)); +// CHECK-LABEL: @_ZN6test522f4IJNS_1XEEEEDTclonplspfp_EEDpT_ +void use() { f4(X{}); } +} -- 2.40.0