[Bug c++/122786] [modules] section attribute in interface modules are silently dropped
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Mar 21 00:22:18 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122786
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:
https://gcc.gnu.org/g:8e3c5ce5e802225a7416a32a9d9a3c2bb2380874
commit r16-8242-g8e3c5ce5e802225a7416a32a9d9a3c2bb2380874
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date: Thu Mar 19 22:58:11 2026 +1100
c++/modules: Support section attributes [PR122786]
This is a minimal fix to not just silently drop the section attribute on
stream-in. Ideally we should be using cplus_decl_attributes for this,
but it's not yet ready for modules (many attributes behave weirdly when
applied not during parsing). We should also be checking for
incompatible sections on stream-in in is_matching_decl, but that would
also be better handled more generally so I'm leaving that out of this
patch.
Instead this minimally fixes the issue by just re-applying the section
name from the attributes we've streamed in.
PR c++/122786
gcc/cp/ChangeLog:
* module.cc (trees_in::decl_value): Set section name from
attribute.
gcc/testsuite/ChangeLog:
* g++.dg/modules/attrib-5_a.C: New test.
* g++.dg/modules/attrib-5_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
More information about the Gcc-bugs
mailing list