mangling parenthesized vs. non-parenthesized calls

John McCall rjmccall at apple.com
Sun Apr 24 06:34:56 UTC 2011


Parentheses in C++ don't matter except when they do.  One case
that our mangling doesn't seem to capture correctly is when a call
operand is an unqualified id-expression, e.g.:

  template <class T> auto call(T t) -> decltype(foo(t)) {
    return foo(t);
  }

vs.

  template <class T> auto call(T t) -> decltype((foo)(t)) {
    return foo(t);
  }

In the second case, argument-dependent lookup is suppressed,
but both will be mangled identically because parentheses are
dropped and we only have one call mangling.

We probably don't want to change the mangling for calls in
general, so I would suggest
  <expression> ::= cp <simple-id> <expression>* E
which will *only* be used for calls where the function operand
is parenthesized and where ADL would be triggered if it weren't.

John.



More information about the cxx-abi-dev mailing list