Hi,

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.

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

The first special-name would have no trailing number, the second would have
'0' and so on allocated in lexical order.

For this example, the following names would be emitted:
_ZGR1bIvE would be given to the 'B' object that 't' would refer to.
_ZGR1bIvE0 would be given to the array of 'A' object references
_ZGR1bIvE1 would be given to the object containing the first array of ints,
{1, 2, 3}
_ZGR1bIvE2 would be given to the object containing the second array of
ints, {4, 5, 6}

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

Reply via email to