aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.cc
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2025-04-01 16:36:30 +1100
committerNathaniel Shead <nathanieloshead@gmail.com>2025-04-02 07:20:36 +1100
commit0210bedf481a9fd248ce29650b824bcd84c3723c (patch)
tree75993b058b0de1185be3854fc993a043f1bc8252 /gcc/ada/gcc-interface/utils.cc
parent9aa78d771222cd9aec463ee28f9039d306ab5834 (diff)
downloadgcc-0210bedf481a9fd248ce29650b824bcd84c3723c.zip
gcc-0210bedf481a9fd248ce29650b824bcd84c3723c.tar.gz
gcc-0210bedf481a9fd248ce29650b824bcd84c3723c.tar.bz2
c++/modules: Forbid exposures of TU-local entities in inline variables [PR119551]
An inline variable has vague linkage, and needs to be conditionally emitted in TUs that reference it. Unfortunately this clashes with [basic.link] p14.2, which says that we ignore the initialisers of all variables (including inline ones), since importers will not have access to the referenced TU-local entities to write the definition. This patch makes such exposures be ill-formed. One case that continues to work is if the exposure is part of the dynamic initialiser of an inline variable; in such cases, the definition has been built as part of the module interface unit anyway, and importers don't need to write it out again, so such exposures are "harmless". PR c++/119551 gcc/cp/ChangeLog: * module.cc (trees_out::write_var_def): Only ignore non-inline variable initializers. gcc/testsuite/ChangeLog: * g++.dg/modules/internal-5_a.C: Add cases that should be ignored. * g++.dg/modules/internal-5_b.C: Test these new cases, and make the testcase more robust. * g++.dg/modules/internal-11.C: New test. * g++.dg/modules/internal-12_a.C: New test. * g++.dg/modules/internal-12_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Diffstat (limited to 'gcc/ada/gcc-interface/utils.cc')
0 files changed, 0 insertions, 0 deletions