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 <[email protected]>: https://gcc.gnu.org/g:8e3c5ce5e802225a7416a32a9d9a3c2bb2380874 commit r16-8242-g8e3c5ce5e802225a7416a32a9d9a3c2bb2380874 Author: Nathaniel Shead <[email protected]> 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 <[email protected]> Reviewed-by: Jason Merrill <[email protected]>
