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

--- Comment #3 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:e0ac5e1c8a69fec114fc5896cf90b4c0b05240c5

commit r16-5584-ge0ac5e1c8a69fec114fc5896cf90b4c0b05240c5
Author: Nathaniel Shead <[email protected]>
Date:   Sat Nov 22 22:30:32 2025 +1100

    c++/modules: Walk indirectly exposed namespaces [PR122699]

    In some situations, such as friend injection, we may add an entity to a
    namespace without ever explicitly opening that namespace in this TU.

    We currently have an additional loop to make sure the namespace is
    considered purview, but this isn't sufficient to make
    walk_module_binding find it, since the namspace itself is not in the
    current TU's symbol table.  This patch ensures we still process the
    (hidden) binding for the injected friend in this TU.

            PR c++/122699

    gcc/cp/ChangeLog:

            * name-lookup.h (expose_existing_namespace): Declare.
            * name-lookup.cc (expose_existing_namespace): New function.
            (push_namespace): Call it.
            * pt.cc (tsubst_friend_function): Likewise.

    gcc/testsuite/ChangeLog:

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

    Signed-off-by: Nathaniel Shead <[email protected]>
    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to