[cxx-abi-dev] Mangling of function reference

Jason Merrill jason at redhat.com
Wed Apr 3 15:20:12 UTC 2013


On 05/11/2012 09:00 PM, John McCall wrote:
> -- diff begin --
>   Empty parameter lists, whether declared as () or conventionally as (void), are encoded with a void parameter specifier (v). Therefore function types always encode at least one parameter type, and function manglings can always be distinguished from data manglings by the presence of the type. Member functions do not encode the types of implicit parameters, either this or the VTT parameter.
>
> -A "Y" prefix for the bare function type encodes extern "C". If there are any cv-qualifiers or a ref-qualifier of this, they are encoded at the beginning of the <qualified-name> as described above. This affects only type mangling, since extern "C" function objects have unmangled names.
> +When mangling a non-static member function name, if there are any cv-qualifiers or a ref-qualifier of this, they are encoded at the beginning of the <qualified-name> as described above.  When mangling any other function type, if there are any cv-qualifiers or a ref-qualifier, they are encoded as part of the function type as described below.
> +
> +A "Y" prefix for the bare function type encodes extern "C" in implementations which distinguish between function types with "C" and "C++" language linkage. This affects only type mangling, since extern "C" function objects have unmangled names.
> -- diff end --

We should also clarify whether the modified function type is a 
substitution candidate.  That is, given

template <class T, class U> struct A { };
void f (A<void()const, void()> *){}

whether f is mangled as

_Z1fP1AIKFvvES0_E
or
_Z1fP1AIKFvvEFvvEE

G++ currently treats it as a substitution candidate, clang 3.2 does not, 
and EDG 4.4 neither treats it as a substitution candidate nor mangles 
the 'const'.

I think not treating it as a substitution candidate is most consistent 
with the language rules, and with the mangling rule for pointer to 
member function types.

Incidentally, the change above hasn't been applied to the published ABI yet.

Jason



More information about the cxx-abi-dev mailing list