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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Nathaniel Shead
<[email protected]>:

https://gcc.gnu.org/g:504ed6eb3e62a20e6fab6281731b9bcd6ba4c090

commit r15-10936-g504ed6eb3e62a20e6fab6281731b9bcd6ba4c090
Author: Nathaniel Shead <[email protected]>
Date:   Tue Mar 3 01:24:06 2026 +1100

    c++/modules: Merge synthesized definitions of defaulted members [PR124311]

    When a TU synthesizes a definition of a defaulted member function we
    mark the TU that did this as the originating module, and so export it
    from there.  If this TU is imported into a module that already has a
    declaration of this entity the declarations should be merged.

    This patch fixes an issue where this merging was not occurring for
    explicitly defaulted member functions, by checking DECL_DEFAULTED_FN
    instead of just DECL_ARTIFICIAL.

            PR c++/124311

    gcc/cp/ChangeLog:

            * module.cc (trees_in::key_mergeable): Check DECL_DEFAULTED_FN
            instead of DECL_ARTIFICIAL.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/imp-member-5_a.C: New test.
            * g++.dg/modules/imp-member-5_b.C: New test.
            * g++.dg/modules/imp-member-5_c.C: New test.

    Signed-off-by: Nathaniel Shead <[email protected]>
    Reviewed-by: Jason Merrill <[email protected]>
    (cherry picked from commit 2d1bf27b49d5d6cbe38a2a2cd8291ed8f98e1a31)

Reply via email to