]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: pruning non-captures in noexcept lambda [PR119764]
authorJason Merrill <jason@redhat.com>
Mon, 14 Apr 2025 16:18:06 +0000 (12:18 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 25 Apr 2025 15:51:07 +0000 (11:51 -0400)
commit44e31eb265ba1984638908466a88095744a88709
treeb2fcca467c6ddcbb3a32d937864be7ba84c1db0c
parentb13bb5045c5010f38169b9786819a024f64fb59d
c++: pruning non-captures in noexcept lambda [PR119764]

The patch for PR87185 fixed the ICE without fixing the underlying problem,
that we were failing to find the declaration of the capture proxy that we
are trying to decide whether to prune.  Fixed by looking at the right index
in stmt_list_stack.

Since this changes captures, it changes the ABI of noexcept lambdas; we
haven't worked hard to maintain lambda capture ABI, but it's easy enough to
control here.

PR c++/119764
PR c++/87185

gcc/cp/ChangeLog:

* lambda.cc (insert_capture_proxy): Handle noexcept lambda.
(prune_lambda_captures): Likewise, in ABI v21.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/lambda/lambda-noexcept1.C: New test.
gcc/cp/lambda.cc
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-noexcept1.C [new file with mode: 0644]