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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Marek Polacek
<[email protected]>:

https://gcc.gnu.org/g:6d87c68f9904bab176c26359cdbb4a9001247cff

commit r16-9275-g6d87c68f9904bab176c26359cdbb4a9001247cff
Author: Marek Polacek <[email protected]>
Date:   Mon Jul 13 17:47:09 2026 -0400

    c++: ICE with requires and -Wsequence-point [PR126066]

    We trip on the assert in lvalue_kind/MODOP_EXPR whose comment says
    that we expect to see MODOP_EXPRs only during template processing.
    In this test we get there with processing_template_decl==0.  The
    MODOP_EXPR is created in:

        /* Parse the requirement body. */
        ++processing_template_decl;
        reqs = cp_parser_requirement_body (parser);
        --processing_template_decl;

    but we're not in a template when calling maybe_convert_cond which
    calls verify_sequence_points which ends up calling lvalue_p on
    the MODOP_EXPR.

    verify_sequence_points is walking the unevaluated operand of a requires
    because verify_tree assumes that all unknown expressions are evaluated, and
    REQUIRES_EXPR looks like a normal expression (tcc_expression).

    The trunk patch changed REQUIRES_EXPR to tcc_exceptional.  But in 16, we
    can just dial the assert down to _checking.

            PR c++/126066

    gcc/cp/ChangeLog:

            * tree.cc (lvalue_kind) <case MODOP_EXPR>: Use
            gcc_checking_assert instead of gcc_assert.

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

Reply via email to