diff options
author | Marek Polacek <polacek@redhat.com> | 2023-02-16 17:41:24 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2023-02-20 09:17:12 -0500 |
commit | 02d8ab3e4e2f3d9dc12157a98c976d6698e71e29 (patch) | |
tree | aab79f1511482abb51b2e431eafed5bcdde86a1e /gcc/gensupport.h | |
parent | 63471c5008819bbf6ec32a6f4d8701fe57b96fa9 (diff) | |
download | gcc-02d8ab3e4e2f3d9dc12157a98c976d6698e71e29.zip gcc-02d8ab3e4e2f3d9dc12157a98c976d6698e71e29.tar.gz gcc-02d8ab3e4e2f3d9dc12157a98c976d6698e71e29.tar.bz2 |
c++: ICE with redundant capture [PR108829]
Here we crash in is_capture_proxy:
/* Location wrappers should be stripped or otherwise handled by the
caller before using this predicate. */
gcc_checking_assert (!location_wrapper_p (decl));
We only crash with the redundant capture:
int abyPage = [=, abyPage] { ... }
because prune_lambda_captures is only called when there was a default
capture, and with [=] only abyPage won't be in LAMBDA_EXPR_CAPTURE_LIST.
The problem is that LAMBDA_CAPTURE_EXPLICIT_P wasn't propagated
correctly and so var_to_maybe_prune proceeded where it shouldn't.
Co-Authored by: Patrick Palka <ppalka@redhat.com>
PR c++/108829
gcc/cp/ChangeLog:
* pt.cc (prepend_one_capture): Set LAMBDA_CAPTURE_EXPLICIT_P.
(tsubst_lambda_expr): Pass LAMBDA_CAPTURE_EXPLICIT_P to
prepend_one_capture.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/lambda/lambda-108829-2.C: New test.
* g++.dg/cpp0x/lambda/lambda-108829.C: New test.
Diffstat (limited to 'gcc/gensupport.h')
0 files changed, 0 insertions, 0 deletions