Mangling of member functions in decltype expressions

Jason Merrill jason at redhat.com
Mon Mar 1 18:19:27 UTC 2010


On 02/26/2010 03:56 PM, Mike Herrick wrote:
> Consider:
>
>    struct A {
>      void f(int);
>    } a;
>    template<class T>  auto f(T p1) ->  decltype(a.f(p1));
>    int main() {
>      f(0);
>    }
>
> g++ 4.4.3 mangles f as "_Z1fIiEDTcldtL_Z1aEL_ZN1A1fEiEfp_EET_" which g++ demangles as:
>
> decltype ((a.(A::f(int)))(parm#1)) f<int>(int)
>
> However, I can't seem to demangle this with the existing IA-64 ABI rules.  Using:
>
>               ::= dt<expression>  <unqualified-name>               # expr.name
>
> I'm able to match "L_Z1aE" to<expression>, but<unqualified-name>  doesn't reduce to<expr-primary>  (which is what I presume "L_ZN1A1fEiE" represents).
>
> Do you consider this a g++ bug (and a qualified name should not be used), or a problem with the current IA-64 ABI specification?  What do you believe the correct mangling should be?

I don't feel strongly one way or the other, but I think the G++ output 
makes sense; I think there are other places we use the full mangled name 
for non-dependent names, and a plain identifier for dependent ones.

> Also, I ran into this:
>
>    struct A {} a;
>    void (A::*pmf)(int);
>    template<class T>  auto f1(T p1) ->  decltype((a.*pmf)(p1));
>    int main() {
>      f1(0);
>    }
>
> dmf.c: In function 'int main()':
> dmf.c:5: sorry, unimplemented: mangling dotstar_expr
>
> Were you considering proposing an addition to the ABI to support this?

I hadn't considered that yet, but I would certainly support such an 
addition.

Jason



More information about the cxx-abi-dev mailing list