]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Propagate assembler name from local-externs [PR 99508]
authorNathan Sidwell <nathan@acm.org>
Wed, 10 Mar 2021 15:39:51 +0000 (07:39 -0800)
committerNathan Sidwell <nathan@acm.org>
Wed, 10 Mar 2021 15:50:32 +0000 (07:50 -0800)
commitb97af562b574697a4fff7fb8c69f579c01e70dec
tree973d4ef30fad75988a0b0906c98c72742ecc7c6e
parent47cca0288d06bd851e5801d13bbee7d9374b685d
c++: Propagate assembler name from local-externs [PR 99508]

This is another place where our one-true-decl representation breaks
down.  The fix here propagates the assembly name to the ns-scope
alias.  that fixes the reported problem but changes the behaviour when
the user has explicitly declared the entity in its namespace.
However, we didn't handle that case 'correctly' anyway before.
Previously we'd also ignore the explicitly specified assembler name,
now we propagate it.  It's not clear to me what the desired semantics
would be in decorating just one of the local extern declarations this
way.  I don't think we can really do better without propagating this
aliasing property into the middle end (which is also needed for some
constexpr handling, see PR97306).  I tried that before and it turned
into a rat-hole.

PR c++/99508
gcc/cp/
* decl.c (make_rtl_for_nonlocal_decl): Propagate local-extern's
assembler name to the ns alias.
gcc/testsuite/
* g++.dg/ext/pr99508.C: New.
gcc/cp/decl.c
gcc/testsuite/g++.dg/ext/pr99508.C [new file with mode: 0644]