From: Richard Smith Date: Mon, 24 Oct 2016 20:29:40 +0000 (+0000) Subject: Fix mangling of implicit calls to operator-> to only include a single "pt", X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4992f51254e86948e184416239d7267db6037075;p=clang Fix mangling of implicit calls to operator-> to only include a single "pt", rather than including an extra one for each level of 'operator->()' invoked. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285015 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp index db0df363c0..15eb11106a 100644 --- a/lib/AST/ItaniumMangle.cpp +++ b/lib/AST/ItaniumMangle.cpp @@ -3735,7 +3735,10 @@ recurse: case Expr::CXXOperatorCallExprClass: { const CXXOperatorCallExpr *CE = cast(E); unsigned NumArgs = CE->getNumArgs(); - mangleOperatorName(CE->getOperator(), /*Arity=*/NumArgs); + // A CXXOperatorCallExpr for OO_Arrow models only semantics, not syntax + // (the enclosing MemberExpr covers the syntactic portion). + if (CE->getOperator() != OO_Arrow) + mangleOperatorName(CE->getOperator(), /*Arity=*/NumArgs); // Mangle the arguments. for (unsigned i = 0; i != NumArgs; ++i) mangleExpression(CE->getArg(i)); diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index 5d757102ed..8ae67c415a 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -1111,3 +1111,10 @@ void fn(T, __underlying_type(T)) {} template void fn(E, __underlying_type(E)); // CHECK-LABEL: @_ZN6test552fnINS_1EEEEvT_U3eutS2_ } + +namespace test56 { + struct A { A *operator->(); int n; } a; + template void f(decltype(a->n + N)) {} + // CHECK-LABEL: @_ZN6test561fILi0EEEvDTplptL_ZNS_1aEE1nT_E + template void f<0>(int); +}