diff options
author | Jason Merrill <jason@redhat.com> | 2019-01-24 16:23:33 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-01-24 16:23:33 -0500 |
commit | b5d0294eafc305eaf15eaee914cccab148fb51f0 (patch) | |
tree | 67889379df002d31eddb52c1ab9859fbe535a995 /gcc/cp/mangle.c | |
parent | d8b5a1a00d4f88aa82c9119095e2b4993444f6ee (diff) | |
download | gcc-b5d0294eafc305eaf15eaee914cccab148fb51f0.zip gcc-b5d0294eafc305eaf15eaee914cccab148fb51f0.tar.gz gcc-b5d0294eafc305eaf15eaee914cccab148fb51f0.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r-- | gcc/cp/mangle.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 00bde4e..f550b75 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -4240,10 +4240,7 @@ decl_tls_wrapper_p (const tree fn) } /* Return an identifier for the name of a temporary variable used to - initialize a static reference. This isn't part of the ABI, but we might - as well call them something readable. */ - -static GTY(()) int temp_count; + initialize a static reference. This is now part of the ABI. */ tree mangle_ref_init_variable (const tree variable) @@ -4254,7 +4251,7 @@ mangle_ref_init_variable (const tree variable) write_name (variable, /*ignore_local_scope=*/0); /* Avoid name clashes with aggregate initialization of multiple references at once. */ - write_unsigned_number (temp_count++); + write_compact_number (current_ref_temp_count++); return finish_mangling_get_identifier (); } |