https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89001
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Thu Jan 24 21:23:33 2019 New Revision: 268252 URL: https://gcc.gnu.org/viewcvs?rev=268252&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/g++.dg/abi/ref-temp1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c trunk/gcc/cp/cp-tree.h trunk/gcc/cp/mangle.c trunk/gcc/cp/typeck2.c trunk/gcc/testsuite/g++.dg/cpp1z/decomp34.C