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

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

https://gcc.gnu.org/g:947e0d1811805468116b0d497bd62779273bfa2b

commit r15-9593-g947e0d1811805468116b0d497bd62779273bfa2b
Author: Nathaniel Shead <nathanielosh...@gmail.com>
Date:   Mon Apr 21 19:58:03 2025 +1000

    c++/modules: Find non-exported reachable decls when instantiating friend
classes [PR119863]

    In r15-9029-geb26b667518c95, we started checking for conflicting
    declarations with any reachable decl attached to the same originating
    module.  This exposed the issue in the PR, where we would always create
    a new type even if a matching type existed in the original module.

    This patch reworks lookup_imported_hidden_friend to handle this case
    better, by first checking for any reachable decl in the attached module
    before looking in the mergeable decl slots.

            PR c++/119863

    gcc/cp/ChangeLog:

            * name-lookup.cc (get_mergeable_namespace_binding): Remove
            no-longer-used function.
            (lookup_imported_hidden_friend): Also look for hidden imported
            decls in an attached decl's module.

    gcc/testsuite/ChangeLog:

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

    Signed-off-by: Nathaniel Shead <nathanielosh...@gmail.com>
    (cherry picked from commit 948ea8766780f7e44f39ccde3f2436ac2fec80da)

Reply via email to