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

--- Comment #9 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:4a718209d448f6a0b609421f7df7ad2761182c72

commit r16-6140-g4a718209d448f6a0b609421f7df7ad2761182c72
Author: Patrick Palka <[email protected]>
Date:   Mon Dec 15 14:23:52 2025 -0500

    c++: delay noexcept parsing for templated friends [PR122668]

    The r16-5425 workaround to delay current-instantiation name lookup
    within a friend's noexcept-spec is unsound because it considers the
    flag cp_noexcept_operand but that indicates a noexcept-expr, not a
    noexcept-spec.  We don't currently have a flag for indicating a
    noexcept-spec context (and I don't think we really want one).

    This patch reverts that workaround and instead makes us properly
    delay noexcept-spec parsing of templated friends, which should fully
    address the regression since it's applicable only to ahead of time
    name lookup at class template scope.  Delaying noexcept-spec parsing
    of non-templated friends is trickier since it means we need to defer
    declaration matching of such friends until after delayed parsing rather
    than immediately matching.  In contrast, for templated friends we
    naturally defer declaration matching until instantiation time, i.e.
    well after delayed parsing.

            PR c++/122668
            PR c++/114764

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_class_specifier): Adjust after
            changing the element type of unparsed_noexcepts.  Pass
            the class type to noexcept_override_late_checks.
            (cp_parser_member_declaration): Set
            CP_PARSER_FLAGS_DELAY_NOEXCEPT also for templated friends.
            (noexcept_override_late_checks): Add class_type parameter.
            (cp_parser_single_declaration): Set
            CP_PARSER_FLAGS_DELAY_NOEXCEPT also for template friends
            at class template scope.
            (cp_parser_save_default_args): Push current_class_type
            to unparsed_noexcepts.
            * parser.h (cp_unparsed_functions_entry::noexcepts):
            Change element type to cp_default_arg_entry.
            * pt.cc (dependentish_scope_p): Revert r16-5425 change.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/noexcept91a.C: New test.

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

Reply via email to