[cxx-abi-dev] Mangling of reference temporaries

Jason Merrill jason at redhat.com
Mon May 5 20:45:08 UTC 2014


On 05/04/2014 11:00 PM, David Majnemer wrote:
> 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.

Why?  As long as b<void> is itself unique, why does it matter what the 
name of the temporary it points to is?  All access to the temporary 
should go through the named variable.

Jason



More information about the cxx-abi-dev mailing list