[cxx-abi-dev] Mangling sizeof

Doug Gregor doug.gregor at gmail.com
Wed Mar 11 17:34:11 UTC 2009


On Wed, Mar 11, 2009 at 9:25 AM, Jason Merrill <jason at redhat.com> wrote:
> Doug Gregor wrote:
>>
>> On Fri, Mar 6, 2009 at 2:34 PM, Jason Merrill <jason at redhat.com> wrote:
>>>
>>> * Separate cast forms
>>>
>>> Currently EDG and g++ mangle static_cast, const_cast, C cast and
>>> functional
>>> cast the same (cv type expr), and g++ doesn't support mangling
>>> reinterpret_cast or dynamic_cast.  EDG also mangles reinterpret_cast the
>>> same, and gets a substitution failure for dynamic_cast.
>>>
>>> The distinction between different cast varieties definitely affects the
>>> validity of an expression, but it's not clear whether or not it can cause
>>> a
>>> substitution failure.
>>
>> 14.8.2p8 (in n2800) makes it pretty clear that any expression can
>> cause a substitution failure; the list of bullets is just a note, now.
>
> Good point.  So they really should all be mangled differently, though
> C-style and functional casts can stay the same.  But that's a binary
> incompatibility that should probably wait until we're ready to deploy a
> bunch of binary-incompatible changes.

Do casts within mangled sizeof()s actually work well in any compiler?
If not, then we might have more wiggle-room to fix this sooner rather
than later.

> If we're dropping type stubs, that reintroduces the issue of what to do with
> function parameters.  I think it may still make sense to use type stubs for
> them; the name of the parameter is not part of the signature, and I don't
> think it's possible, given two parameters of the same type, for it to make a
> difference which one you use in a decltype/sizeof expression.
>  Alternatively, we could just introduce a mangling for "function parameter
> N".  Which might be simpler.

I'd prefer the introduction of a mangling for "function parameter N".

  - Doug



More information about the cxx-abi-dev mailing list