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

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

commit r17-3659-g7d46e0676e2e6b106483887ce84b8cb3042d51ea
Author: Odysseas Georgoudis <[email protected]>
Date:   Mon Jul 27 13:05:05 2026 +0000

    c++: Fix lambda scope cleanup after class error [PR125343]

    cp_parser_class_head opens a lambda mangling scope for a valid class
    head.  If begin_class_definition rejects that type, it replaces it with
    error_mark_node.  The old cleanup condition consequently leaves the
    scope open, and lambda error recovery reaches
    record_lambda_scope_sig_discriminator with the wrong active scope.

    Remember whether the class head opened a lambda scope and use that
    state for cleanup independently of whether the definition succeeds.

            PR c++/125343

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_class_specifier): Preserve whether the
            class head opened a lambda scope and use it for cleanup.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/pr125343.C: New test.

    Signed-off-by: Odysseas Georgoudis <[email protected]>

Reply via email to