On Apr 3, 2013, at 8:20 AM, Jason Merrill <[email protected]> wrote:
> 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.

This was actually covered in my original proposal:

Therefore I propose the following change:

-- diff begin --
-    <function-type> ::= F [Y] <bare-function-type> E
+    <function-type> ::= [<CV-qualifiers>] F [Y] <bare-function-type> 
[<ref-qualifier>] E
     <bare-function-type> ::= <signature type>+
         # types are possible return type, then parameter types

+For the purposes of substitution, the CV-qualifiers and ref-qualifier of a 
function type are an indivisible part of the type;  that is, when mangling 
'void () const', 'void ()' is not a substitution candidate.
-- diff end --

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

Thanks!  I also noticed that Doug's patch for ref-qualifiers from January 2011 
hadn't been committed, so I've done that, too.

John.
_______________________________________________
cxx-abi-dev mailing list
[email protected]
http://sourcerytools.com/cgi-bin/mailman/listinfo/cxx-abi-dev

Reply via email to