[Bug c++/126783] [16/17 Regression] [modules] ICE when a GMF variable is later defined inline

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126783

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Patrick Palka
<[email protected]>:

https://gcc.gnu.org/g:61f16b5960e4a53d7ac5881f4db74ccfb7cb6df7

commit r16-9532-g61f16b5960e4a53d7ac5881f4db74ccfb7cb6df7
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]>
    (cherry picked from commit a03b3ab4b0a6a446fe9a1d7e6e82967a8dd3edcf)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.