https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126783
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <[email protected]>: https://gcc.gnu.org/g:a03b3ab4b0a6a446fe9a1d7e6e82967a8dd3edcf commit r17-3268-ga03b3ab4b0a6a446fe9a1d7e6e82967a8dd3edcf Author: Patrick Palka <[email protected]> Date: Thu Aug 13 18:07:25 2026 -0400 c++/modules: ICE with GMF variable later defined inline [PR126783] Here transfer_defining_module (added in r16-5213) assumes that if a redeclaration has DECL_LANG_SPECIFIC allocated, then so must the original declaration, but this isn't true for q below. Instead we should call retrofit_lang_decl to allocate DECL_LANG_SPECIFIC as needed; other parts of duplicate_decls do the same. PR c++/126783 gcc/cp/ChangeLog: * module.cc (transfer_defining_module): Call retrofit_lang_decl instead of assuming the old declaration already has DECL_LANG_SPECIFIC allocated. gcc/testsuite/ChangeLog: * g++.dg/modules/gmf-6.C: New test. Reviewed-by: Jason Merrill <[email protected]>
