From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A84C389043A; Fri, 16 Apr 2021 07:35:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A84C389043A From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99850] [P1102R2] reject valid lambda syntax in C++23 Date: Fri, 16 Apr 2021 07:35:15 +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: 11.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: Fri, 16 Apr 2021 07:35:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99850 --- Comment #6 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:784de5292c34e287c848b382b431599b818ea76e commit r11-8210-g784de5292c34e287c848b382b431599b818ea76e Author: Jakub Jelinek Date: Fri Apr 16 09:34:26 2021 +0200 c++: Fix up C++23 [] <...> requires primary -> type {} parsing [PR99850] The requires clause parsing has code to suggest users wrapping non-primary expressions in (), so if it e.g. parses a primary expression and sees it is followed by ++, --, ., ( or -> among other things it will try to reparse it as assignment expression or what and if that wor= ks suggests wrapping it inside of parens. When it is requires-clause that is after etc. it already has an exception from that as ( can occur in valid C++20 expression the= re - starting the parameters of the lambda. In C++23 another case can occur, as the parameters with the ()s can be omitted, requires C can be followed immediately by -> which starts a trailing return type. Even in that case, we don't want to parse that as C->... 2021-04-16 Jakub Jelinek PR c++/99850 * parser.c (cp_parser_constraint_requires_parens) : If lambda_p, return pce_ok instead of pce_maybe_postfix. * g++.dg/cpp23/lambda-specifiers2.C: New test.=