From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9D5D4384AB4D; Thu, 9 May 2024 17:03:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D5D4384AB4D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715274230; bh=+8uMD/H9FXd9GUz6Hxfh7Rfi0KuHjCN5m2P67oBYz1c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vPM6FMfuyK5qY4AjK+M7aS2lZk5+WJsA/k4OLoEnHdi8je+vgb32gGvoCJlhLCSO2 jcXVBYEt6qUnqQ9Yb3xAAEPH6AZqZTKEF4Wiaz3zdspMbmINTJDVzgRwI1d96Pqj+n qQj/Lo5wEjL9uEhcK1byj4+SUAnGHUkyIEJnaO5c= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/85889] lambda expression can capture structured bindings Date: Thu, 09 May 2024 17:03:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 8.1.1 X-Bugzilla-Keywords: accepts-invalid, c++-lambda X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D85889 --- Comment #6 from GCC Commits --- The trunk branch has been updated by Marek Polacek : https://gcc.gnu.org/g:46bafd9a6b9b776142e0b1424a6ac02e3a2fd300 commit r15-348-g46bafd9a6b9b776142e0b1424a6ac02e3a2fd300 Author: Marek Polacek Date: Fri Mar 1 17:13:02 2024 -0500 c++: lambda capturing structured bindings [PR85889] clarifies that it's OK to capture structured bindings. [expr.prim.lambda.capture]/4 says "The identifier in a simple-capture s= hall denote a local entity" and [basic.pre]/3: "An entity is a [...] structu= red binding". It doesn't appear that this was made a DR, so, strictly speaking, we should have a -Wc++20-extensions warning, like clang++. PR c++/85889 gcc/cp/ChangeLog: * lambda.cc (add_capture): Add a pedwarn for capturing structur= ed bindings. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/decomp3.C: Use -Wno-c++20-extensions. * g++.dg/cpp1z/decomp60.C: New test.=