https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122551

--- Comment #1 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:5fbcd8a57a0f2524259df87db5c6c82b757bf2e6

commit r16-5213-g5fbcd8a57a0f2524259df87db5c6c82b757bf2e6
Author: Nathaniel Shead <[email protected]>
Date:   Tue Nov 11 17:13:46 2025 +1100

    c++/modules: Maintain attachment of temploid friends after duplicate_decls
[PR122551]

    The ICE in the PR is because we're attempting to create a binding for an
    imported declaration.  This is problematic because if there are
    duplicates we'll stream via a tt_entity, but won't enable deduplication
    on the relevant binding vectors which can cause issues.

    The root cause seems to stem from us forgetting that we've produced a
    declaration for this entity within our own module, and so the active
    declaration is not purely from an imported entity.  We also didn't
    properly track that this entity has unusual module attachment and
    despite being declared here without being an instantiation actually is
    attached to a different module than the current one (which may have
    caused other problems down the line).  This patch fixes both of these
    issues.

            PR c++/122551

    gcc/cp/ChangeLog:

            * cp-tree.h (transfer_defining_module): Declare.
            * decl.cc (duplicate_decls): Call it for all decls.
            Remove now unnecessary equivalent logic for templates.
            * module.cc (mangle_module): Add assertion.
            (transfer_defining_module): New function.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/tpl-friend-20_a.C: New test.
            * g++.dg/modules/tpl-friend-20_b.C: New test.
            * g++.dg/modules/tpl-friend-20_c.C: New test.

    Signed-off-by: Nathaniel Shead <[email protected]>
    Reviewed-by: Jason Merrill <[email protected]>
  • [Bug c++/122551] [modules] ICE ... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to