From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E96793948A75; Mon, 9 May 2022 19:57:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E96793948A75 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103539] [C++23] P2324 - Labels at the end of compound statements Date: Mon, 09 May 2022 19:57:24 +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: 12.0 X-Bugzilla-Keywords: rejects-valid 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2022 19:57:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103539 --- Comment #1 from CVS Commits --- The trunk branch has been updated by Marek Polacek : https://gcc.gnu.org/g:4b2a6628644b2ce15d877c1e85d14e314965a296 commit r13-217-g4b2a6628644b2ce15d877c1e85d14e314965a296 Author: Marek Polacek Date: Sun May 8 17:36:34 2022 -0400 c++: Implement P2324R2, labels at the end of compound-stmts [PR103539] This patch implements C++23 , which allows labels at the end of a compound statement. Its C FE counterpart was already implemented in r11-4813. In cp_parser_statement I rely on in_compound to determine whether we're in a compound-statement, so that the patch doesn't accidentally allow void fn(int c) { if (c) label: } Strangely, in_compound was reset after seeing a label (this is tested in c-c++-common/gomp/pr63326.c), so I've made a modifiable copy specific for OpenMP #pragma purposes. PR c++/103539 gcc/cp/ChangeLog: * parser.cc (cp_parser_statement): Constify the in_compound parameter. Create a modifiable copy. Allow labels at the end of compound statements. gcc/testsuite/ChangeLog: * g++.dg/cpp23/label1.C: New test. * g++.dg/cpp23/label2.C: New test.=