]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR c++/89001 - mangling of reference temporaries
authorJason Merrill <jason@redhat.com>
Thu, 24 Jan 2019 21:23:33 +0000 (16:23 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 24 Jan 2019 21:23:33 +0000 (16:23 -0500)
commitb5d0294eafc305eaf15eaee914cccab148fb51f0
tree67889379df002d31eddb52c1ab9859fbe535a995
parentd8b5a1a00d4f88aa82c9119095e2b4993444f6ee
PR c++/89001 - mangling of reference temporaries

It used to be the case that the mangled name of a reference temporary didn't
need to be standardized, because all access would be through the reference.
But now constant expressions can look through references and so different
translation units need to agree on the address of a temporary in the
initializer of a reference with vague linkage.

* cp-tree.h (struct saved_scope): Add ref_temp_count.
(current_ref_temp_count): New macro.
* mangle.c (mangle_ref_init_variable): Use it.
* typeck2.c (store_init_value): Clear it.
* call.c (make_temporary_var_for_ref_to_temp): Copy public and
comdat.

From-SVN: r268252
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/cp/mangle.c
gcc/cp/typeck2.c
gcc/testsuite/g++.dg/abi/ref-temp1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/decomp34.C