[cxx-abi-dev] Mangling of anonymous unions?

Jason Merrill jason at redhat.com
Wed Dec 18 22:58:02 UTC 2002


On Wed, 18 Dec 2002 15:54:30 -0500, Jason Merrill <jason at redhat.com> wrote:

> I just noticed that the ABI doesn't define a mangling for anonymous
> unions.  This is only really relevant for static local anonymous unions in
> inline functions; all others are private to a translation unit.
>
> The choices would seem to be:
>
> 1) Use the name of the first member.
> 2) Use the name of the largest member.
> 3) Treat them like string literals, perhaps using 'u' instead of 's'.
>
> g++ currently does #2.  But it also fails to allocate space for such a
> union (q.v. g++.brendan/union1.C), so there's no binary compatibility issue
> in choosing a different answer.
>
> My order of preference is 3, 1, 2.  And yes, I'm volunteering to fix g++.

After working on this for a bit, I like #3 much less; it doesn't work very
well for namespace-scope unions, which we might as well mangle the same
way.

Jason



More information about the cxx-abi-dev mailing list