public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94376] When nested inside a lambda body, [=] captures by const value instead of by value Date: Sun, 19 Dec 2021 19:42:38 +0000 [thread overview] Message-ID: <bug-94376-4-mvnJbQUTUF@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-94376-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94376 --- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:89cf57ea35d1e0a0b818997c737ac70b7310d9d9 commit r12-6065-g89cf57ea35d1e0a0b818997c737ac70b7310d9d9 Author: Patrick Palka <ppalka@redhat.com> Date: Sun Dec 19 14:42:14 2021 -0500 c++: nested lambda capturing a capture proxy, cont [PR94376] The r12-5403 fix apparently doesn't handle the case where the inner lambda explicitly rather than implicitly captures the capture proxy from the outer lambda, which causes us to reject the first example in the testcase below. This is because compared to an implicit capture, the effective initializer for an explicit capture is wrapped in a location wrapper (pointing to within the capture list), and this wrapper foils the is_capture_proxy check added in r12-5403. The simplest fix appears to be to strip location wrappers accordingly before checking is_capture_proxy. And to help prevent against this kind of bug, this patch also makes is_capture_proxy assert it doesn't see a location wrapper. PR c++/94376 gcc/cp/ChangeLog: * lambda.c (lambda_capture_field_type): Strip location wrappers before checking for a capture proxy. (is_capture_proxy): Assert that we don't see a location wrapper. (mark_const_cap_r): Don't call is_constant_capture_proxy on a location wrapper. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-nested9a.C: New test.
next prev parent reply other threads:[~2021-12-19 19:42 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-28 0:14 [Bug c++/94376] New: " arthur.j.odwyer at gmail dot com 2021-11-02 17:27 ` [Bug c++/94376] " ppalka at gcc dot gnu.org 2021-11-19 13:54 ` cvs-commit at gcc dot gnu.org 2021-11-19 13:56 ` ppalka at gcc dot gnu.org 2021-12-19 19:42 ` cvs-commit at gcc dot gnu.org [this message] 2021-12-28 10:01 ` pinskia at gcc dot gnu.org 2022-04-26 20:26 ` ppalka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-94376-4-mvnJbQUTUF@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).