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

--- 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:c31d01c3eaecfce32659d5e6acaf0cd858ef0569

commit r17-206-gc31d01c3eaecfce32659d5e6acaf0cd858ef0569
Author: Patrick Palka <[email protected]>
Date:   Wed Apr 29 08:48:50 2026 -0400

    c++/modules: memfn merging wrt to obj-ness [PR125035]

    Here we ICE during declaration merging for the streamed-in static A::f
    because we incorrectly match with the in-TU iobj A::f instead of the
    in-TU static A::f.

    The problem is the merge key doesn't have enough information to discern
    between two overloads that essentially only differ by whether they have
    an object parameter (and whether it's implicit or explicit).  To that end
    this patch adds iobj_p and xobj_p bits to merge_key.

            PR c++/125035

    gcc/cp/ChangeLog:

            * module.cc (merge_key): Add iobj_p and xobj_p bits.
            (trees_out::key_mergeable) <case MK_named>: Set and stream
            merge_key's iobj_p and xobj_p bits.
            (check_mergeable_decl) <case FUNCTION_DECL>: Compare merge_key's
            iobj_p and xobj_p bits with that of the given function.
            (trees_in::key_mergeable): Stream merge_key's iobj_p and xobj_p
            bits.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/merge-22.h: New test.
            * g++.dg/modules/merge-22_a.H: New test.
            * g++.dg/modules/merge-22_b.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to