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

--- Comment #4 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:8da00520ecb80b73b427f0821a444e830a70b475

commit r16-6261-g8da00520ecb80b73b427f0821a444e830a70b475
Author: Nathaniel Shead <[email protected]>
Date:   Fri Dec 5 01:14:36 2025 +1100

    c++/modules: Don't build STAT_HACKs for current TU namespace bindings
[PR122995]

    The issue in the PR is that we're checking if the binding entity for the
    current TU matches the namespace we're pushing.  In this case the slot
    however is a STAT_HACK we created during 'maybe_record_mergeable_decl'
    to indicate that the binding entity contains a global module binding.

    Adding '|| (STAT_HACK_P ((tree) slot) && STAT_DECL ((tree) slot) == ns)'
    should fix the assertion, but I think we want to just not build the
    STAT_HACK for namespaces, as they'll always be global module regardless,
    and cannot match with any other declaration, so there's no need for the
    special flag.

            PR c++/122995

    gcc/cp/ChangeLog:

            * name-lookup.cc (maybe_record_mergeable_decl): Don't build a
            STAT_HACK for namespaces.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/namespace-17_a.C: New test.
            * g++.dg/modules/namespace-17_b.C: New test.

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

Reply via email to