From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3D865385840E; Tue, 4 Jan 2022 20:15:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D865385840E From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103901] A lambda with a new type in its body cannot be defined inside template parameter list Date: Tue, 04 Jan 2022 20:15:30 +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: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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: Tue, 04 Jan 2022 20:15:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103901 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org, | |ppalka at gcc dot gnu.org --- Comment #3 from Jakub Jelinek --- If it is valid, I think e.g. --- gcc/cp/parser.c.jj 2022-01-04 09:59:37.297641779 +0100 +++ gcc/cp/parser.c 2022-01-04 20:56:19.065070397 +0100 @@ -11046,6 +11046,9 @@ cp_parser_lambda_expression (cp_parser* bool save_in_consteval_if_p =3D in_consteval_if_p; in_consteval_if_p =3D false; + int saved_processing_template_parmlist =3D processing_template_parmlis= t; + processing_template_parmlist =3D 0; + /* By virtue of defining a local class, a lambda expression has access= to the private variables of enclosing classes. */ @@ -11078,6 +11081,7 @@ cp_parser_lambda_expression (cp_parser* in_consteval_if_p =3D save_in_consteval_if_p; in_discarded_stmt =3D discarded; + processing_template_parmlist =3D saved_processing_template_parmlist; parser->num_template_parameter_lists =3D saved_num_template_parameter_= lists; parser->in_statement =3D in_statement; should fix that. But as the stack-overflow link says, it is unclear. Also, we still reject even with the above patch decltype ([]{ struct A {} ; return 1; }) a; (guess that is PR101911).=