https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117602
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:6d8a0e8b2cfb5c8997b378f230a4ccdbfacaee4d commit r15-7169-g6d8a0e8b2cfb5c8997b378f230a4ccdbfacaee4d Author: Marek Polacek <pola...@redhat.com> Date: Thu Nov 14 23:47:46 2024 -0500 c++: bogus error with nested lambdas [PR117602] The error here should also check that we aren't nested in another lambda; in it, at_function_scope_p() will be false. PR c++/117602 gcc/cp/ChangeLog: * cp-tree.h (current_nonlambda_scope): Add a default argument. * lambda.cc (current_nonlambda_scope): New bool parameter. Use it. * parser.cc (cp_parser_lambda_introducer): Use current_nonlambda_scope to check if the lambda is non-local. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-uneval21.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com>