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

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

https://gcc.gnu.org/g:549bfeaa0bd2641ed99f1525caf3d54e2126396a

commit r16-6432-g549bfeaa0bd2641ed99f1525caf3d54e2126396a
Author: Egas Ribeiro <[email protected]>
Date:   Thu Dec 25 12:33:47 2025 +0000

    c++: Fix ICE with requires-expression in lambda requires-clause [PR123080]

    When parsing a lambda with a trailing requires-clause, calling
    cp_parser_requires_clause_opt confused generic lambda parsing when
    implicit template parameters were involved.
    After failing to parse a type-requirement during tentative parsing and
    hitting error recovery code in cp_parser_skip_to_end_of_statement that
    aborted the current implicit template, attemping to finish the lambda
    declaration caused ICEs.

    Fix this by not aborting the current implicit template during tentative
    parsing and adding cleanup for fully_implicit_function_template_p.

            PR c++/123080

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_skip_to_end_of_statement): Don't abort
            implicit templates during tentative parsing.
            (cp_parser_lambda_declarator_opt): Add cleanup for
            fully_implicit_function_template_p before parsing
            trailing_requires_clause.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/lambda-requires6.C: New test.
            * g++.dg/cpp2a/lambda-requires6a.C: New test.

    Signed-off-by: Egas Ribeiro <[email protected]>
    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to