[cxx-abi-dev] Pointer to member function mangling

Mark Mitchell mark at codesourcery.com
Wed Jan 30 17:38:07 UTC 2002


>> g++ currently emits
>>
>>   MK1AFvvE
>>
>> or, member of class "const A" of type "function of (void) returning
>> void". I don't see how this can be deduced from the above text.  More
>> consistent with the handling of function names, and suggested by the
>> text in the function type section, would be
>>
>>   MNK1AEFvvE
>
> I don't see that: there is no <nested-name> in the pointer-to-member
> above.

I don't think this is very clearly specified.

Reading literally, a pointer-to-member type is:

  M <class type> <member type>

The problem is that the member type is a function type, and for
function types we don't ever emit the this parameter, so were
does the const-ness go?

Your suggestion here implies a nested name, which Daveed rightly
points out is not present.

>> IMO more consistent with the language semantics would be
>>
>>   M1AKFvvE

This suggestion is fine, but not supported by the grammar.  This
would imply a member whose function type is const -- i.e., something
equivalent to "g" in:

  typedef void (f)();
  typedef const f g;

That's not the right type.

The G++ implementation is relatively logical.  Instead of encoding

  void ()(const A*)

as everyone used to, we now do:

  const A ... void ()

So, while I would be the last to argue that the spec is 100% clear,
I think it supports the G++ version as well as any of the other
ones.

>> What do other compilers produce?  What do other demanglers expect?

This is the right question.  At this point, none of HP, Intel, GNU,
or anyone else is going to be eager to change their compilers.

--
Mark Mitchell                   mark at codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com




More information about the cxx-abi-dev mailing list