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.

llvm-svn: 285015
This commit is contained in:
Richard Smith 2016-10-24 20:29:40 +00:00
parent c968297b95
commit 4631be7402
2 changed files with 11 additions and 1 deletions

View File

@ -3735,7 +3735,10 @@ recurse:
case Expr::CXXOperatorCallExprClass: {
const CXXOperatorCallExpr *CE = cast<CXXOperatorCallExpr>(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));

View File

@ -1111,3 +1111,10 @@ void fn(T, __underlying_type(T)) {}
template void fn<E>(E, __underlying_type(E));
// CHECK-LABEL: @_ZN6test552fnINS_1EEEEvT_U3eutS2_
}
namespace test56 {
struct A { A *operator->(); int n; } a;
template<int N> void f(decltype(a->n + N)) {}
// CHECK-LABEL: @_ZN6test561fILi0EEEvDTplptL_ZNS_1aEE1nT_E
template void f<0>(int);
}