https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88313
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:81db6857686c2d7932949afb948419a575bc0b3f commit r14-10548-g81db6857686c2d7932949afb948419a575bc0b3f Author: Patrick Palka <ppa...@redhat.com> Date: Mon Jul 29 16:37:19 2024 -0400 c++: generic lambda in default template argument [PR88313] Here we're rejecting the generic lambda inside the default template argument ultimately because auto_is_implicit_function_template_parm_p doesn't get set during parsing of the lambda's parameter list, due to the !processing_template_parmlist restriction. But when parsing a lambda parameter list we should always set that flag regardless of where the lambda appears. This patch makes sure of this via a local lambda_p flag. PR c++/88313 gcc/cp/ChangeLog: * parser.cc (cp_parser_lambda_declarator_opt): Pass lambda_p=true to cp_parser_parameter_declaration_clause. (cp_parser_direct_declarator): Pass lambda_p=false to to cp_parser_parameter_declaration_clause. (cp_parser_parameter_declaration_clause): Add bool lambda_p parameter. Consider lambda_p instead of current_class_type when setting parser->auto_is_implicit_function_template_parm_p. Don't consider processing_template_parmlist. (cp_parser_requirement_parameter_list): Pass lambda_p=false to cp_parser_parameter_declaration_clause. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-targ6.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com> (cherry picked from commit 72a7ab891ae0061841c4eb641ef6ab7719bf0369)