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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <[email protected]>:

https://gcc.gnu.org/g:d3f638f4dfe67f50ba298890258ef6466705f0fa

commit r16-5781-gd3f638f4dfe67f50ba298890258ef6466705f0fa
Author: Jakub Jelinek <[email protected]>
Date:   Sun Nov 30 15:52:27 2025 +0100

    c++: Fix error recovery in cp_hide_range_decl [PR122465]

    The following testcase shows that range_decl in cp_hide_range_decl is
    sometimes also NULL_TREE and not just error_mark_node, and the function
    IMHO should treat both the same, not try to hide anything in that case
    because it doesn't know what should be hidden.  This ICEs during
    error recovery since something like cp_hide_range_decl has been introduced
    (earlier it wasn't called that way).

    The fix tweaks cp_parser_simple_declaration, such that it stores
error_mark_node
    instead of NULL_TREE into *maybe_range_for_decl in the erroneous cases.

    2025-11-30  Jakub Jelinek  <[email protected]>

            PR c++/122465
            * parser.cc (cp_parser_simple_declaration): Adjust function
comment.
            Set *maybe_range_for_decl to error_mark_node instead of keeping it
            NULL_TREE in error cases or when followed by CPP_COLON.

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

Reply via email to