c++: Revert deferring emission of inline variables [PR114013]
commit615b62aada6cc42759e5c43e196dab6c524925d6
authorNathaniel Shead <nathanieloshead@gmail.com>
Wed, 28 Feb 2024 00:20:53 +0000 (28 11:20 +1100)
committerNathaniel Shead <nathanieloshead@gmail.com>
Wed, 28 Feb 2024 00:25:21 +0000 (28 11:25 +1100)
tree63c7e6bc5aa6e95578a6f25f2eb823f6c0470745
parent6309ad25c6dc22bf1d47990eedb8a5bec5d7315a
c++: Revert deferring emission of inline variables [PR114013]

This is a (partial) reversion of r14-8987-gdd9d14f7d53 to return to
eagerly emitting inline variables to the middle-end when they are
declared. 'import_export_decl' will still continue to accept them, as
allowing this is a pure extension and doesn't seem to cause issues with
modules, but otherwise deferring the emission of inline variables
appears to cause issues on some targets and prevents some code using
inline variable templates from correctly linking.

There might be a more targetted way to support this, but due to the
complexity of handling linkage and emission I'd prefer to wait till
GCC 15 to explore our options.

PR c++/113970
PR c++/114013

gcc/cp/ChangeLog:

* decl.cc (make_rtl_for_nonlocal_decl): Don't defer inline
variables.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/inline-var10.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
gcc/cp/decl.cc
gcc/testsuite/g++.dg/cpp1z/inline-var10.C [new file with mode: 0644]