[cxx-abi-dev] Mangling of reference temporaries

Richard Smith richardsmith at google.com
Mon May 5 17:02:53 UTC 2014


On 5 May 2014 09:13, John McCall <rjmccall at apple.com> wrote:

> On May 4, 2014, at 8:00 PM, David Majnemer <david.majnemer at gmail.com>
> wrote:
> > The Itanium ABI does not seem to provide a mangling for reference
> temporaries.
> >
> > Consider the following:
> > struct A { const int (&x)[3]; };
> > struct B { const A (&x)[2]; };
> > template <typename T> B &&b = { { { { 1, 2, 3 } }, { { 4, 5, 6 } } } };
> > B &temp = b<void>;
> >
> > The temporaries created by instantiating b<void> must be the same in all
> translation units.
> >
> > To satisfy this requirement, I propose that we mangle the temporaries in
> lexical order using a mangling similar to what GCC 4.9 uses and identical
> to what trunk clang uses.
>
> What does GCC do?


GCC trunk seems to use

  <special-name> ::= GR <object name> <nonnegative number>

where the first reference temporary gets number 0, and so on. It appears to
number them through a post-order tree walk of the expression. Older
versions of GCC did not add a number, IIRC.

I would prefer to not introduce another place where the end of the mangling
> is ambiguous, especially one ending in a number, since that’s a common way
> to generate “unique” function names.  (Or at least LLVM does it, and so I
> have to worry about it personally.)
>
> John.
> _______________________________________________
> cxx-abi-dev mailing list
> cxx-abi-dev at codesourcery.com
> http://sourcerytools.com/cgi-bin/mailman/listinfo/cxx-abi-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20140505/e9797655/attachment.html>


More information about the cxx-abi-dev mailing list