https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121238
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-15 branch has been updated by Nathaniel Shead <nsh...@gcc.gnu.org>: https://gcc.gnu.org/g:16e8d1479f60ea22ba604ac4217d5745c7c80b98 commit r15-10182-g16e8d1479f60ea22ba604ac4217d5745c7c80b98 Author: Nathaniel Shead <nathanielosh...@gmail.com> Date: Thu Jul 31 08:56:09 2025 +1000 c++/modules: Merge PARM_DECL properties from function definitions [PR121238] When we merge a function definition, if there already exists a forward declaration in the importing TU we use the PARM_DECLs belonging to that decl. This usually works fine, except as noted in the linked PR there are some flags (such as TREE_ADDRESSABLE) that only get set on a PARM_DECL once a definition is provided. This patch fixes the wrong-code issues by propagating any properties on PARM_DECLs I could find that may affect codegen. PR c++/121238 gcc/cp/ChangeLog: * module.cc (trees_in::fn_parms_fini): Merge properties for definitions. gcc/testsuite/ChangeLog: * g++.dg/modules/merge-19.h: New test. * g++.dg/modules/merge-19_a.H: New test. * g++.dg/modules/merge-19_b.C: New test. Signed-off-by: Nathaniel Shead <nathanielosh...@gmail.com> Reviewed-by: Jason Merrill <ja...@redhat.com> Reviewed-by: Patrick Palka <ppa...@redhat.com> (cherry picked from commit 70136bdc76ae1774162ccbeeedd33aa531950e68)