[Bug c++/122421] Instantiation in a module does not affect a static array defined outside the module.
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Nov 2 13:59:29 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122421
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Nathaniel Shead
<nshead@gcc.gnu.org>:
https://gcc.gnu.org/g:59213fd40fe5f272f603f5b8303d2c371f05c7a5
commit r15-10474-g59213fd40fe5f272f603f5b8303d2c371f05c7a5
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date: Sun Oct 26 22:27:33 2025 +1100
c++/modules: Track all static class variables [PR122421]
The linker error in the PR is caused because when a static is defined
out of the class body, it doesn't yet have a definition and so
read_var_def (which would otherwise have noted it) never gets called.
This instead moves the responsibility for noting class-scope variables
to read_class_def.
PR c++/122421
gcc/cp/ChangeLog:
* module.cc (trees_in::read_var_def): Don't handle class-scope
variables anymore.
(trees_in::read_class_def): Handle them here instead.
gcc/testsuite/ChangeLog:
* g++.dg/modules/inst-6_a.C: New test.
* g++.dg/modules/inst-6_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit fd5c057c2d01346d69119f88ca94debf27842e4e)
More information about the Gcc-bugs
mailing list