[cxx-abi-dev] Mangling of function reference

Richard Smith richardsmith at google.com
Fri May 11 18:31:19 UTC 2012


On Fri, May 11, 2012 at 11:30 AM, Richard Smith <richardsmith at google.com>wrote:

> On Thu, May 10, 2012 at 6:58 PM, John McCall <rjmccall at apple.com> wrote:
>
>> On May 10, 2012, at 2:17 PM, Marc Glisse wrote:
>> > it seems that the mangling used by clang and proposed here (although it
>> hasn't made it to the document on the web) is the same for:
>> > void (&)()  // reference to a function
>> > void ()&
>> > where the second one is what you get from a pointer to a member
>> function that takes its *this argument by reference, when you remove the
>> "pointer to member" part of the type. I gave a few more details there:
>> >
>> >
>> http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/b3e459b9a4eb5d7e
>> >
>> > Am I missing something in the analysis? Is this on purpose because the
>> two are unlikely to conflict?
>>
>> There are two language constraints preventing a conflict here:  first,
>> you can't have a <ref-qualifier> on a function type that isn't immediately
>> used to declare a member function or a pointer-to-member-function;  and
>> second, you can't form a member pointer to a field of reference type.
>>
>
> That's not correct. You can have a ref-qualifier on a function type that's
> used as a template argument; see 8.3.5/6. The following are all different
> types:
>
> T<void()>, T<void(&)()>, T<void()&>
>
> The proposed ABI rule says we mangle the second two the same. Clang
> currently mangles the first two the same. Clearly we need three different
> manglings.
>

Sorry, Clang mangles the first and third the same.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20120511/5c5d5aec/attachment.html>


More information about the cxx-abi-dev mailing list