[Bug c++/122884] [16 regression] gcc crashed on lambda within require clause or noexcept clause

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 13 06:05:08 GMT 2026


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

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

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

commit r16-8576-gd6f2b342370a9c5cba912485d3a42539afc1426d
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 13 02:04:35 2026 -0400

    c++: lambda capture scope and requires [PR122884]

    I spent quite a while working on improving our representation of early
    capture proxies, which was enough to make the noexcept work, but eventually
    realized that for constraints, since they are substituted before we start
to
    build the actual function declaration, we need to handle reconstructing
    capture proxies during substitution like we already do for parameters.  So
    this patch only does that; the early proxy representation changes can wait
    for stage 1.

            PR c++/122884

    gcc/cp/ChangeLog:

            * pt.cc (reconstruct_lambda_capture_pack): New.
            (tsubst_pack_expansion): Use it.
            (tsubst_decl): Handle capture proxy.
            (tsubst): Handle lambda closure.
            (tsubst_expr): Handle closure field.
            (tsubst_lambda_expr): Copy closure location.
            * constraint.cc (satisfy_declaration_constraints): Set up
            local_specializations for a lambda.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp23/lambda-scope10.C: New test.
            * g++.dg/cpp23/lambda-scope10a.C: New test.


More information about the Gcc-bugs mailing list