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

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

https://gcc.gnu.org/g:4f5ba54888f6f4f214c094972b1d665f7dc7ea26

commit r16-8121-g4f5ba54888f6f4f214c094972b1d665f7dc7ea26
Author: Marek Polacek <[email protected]>
Date:   Sun Mar 15 16:27:51 2026 -0400

    c++/reflection: fix ICE on invalid splice [PR124496]

    Just an ICE-on-invalid, but while writing tests for 123237 my
    typos would result in this crash often enough to prompt me to
    go ahead and fix it.

    We crash here because we are asserting that we've emitted hard
    errors when cp_parser_splice_specifier returns error_mark_node
    even when parsing tentatively.  In the crash20.C case we have
    [:R<T>:] where we interpret the < as a "less than" operator and
    expect that T will produce a primary expression, which it does
    not.  But cp_parser_error won't emit any errors yet.

            PR c++/124496

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_splice_specifier): Use NULL_TREE instead of
            NULL.
            (cp_parser_splice_expression): Don't assert seen_error() when not
            committed to tentative parse.

    gcc/testsuite/ChangeLog:

            * g++.dg/reflect/crash20.C: New test.
            * g++.dg/reflect/crash21.C: New test.

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

Reply via email to