From 257b640d256d3f84e7307f5fdb08d2208d84f4b8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 24 Jul 2025 15:38:36 -0400 Subject: [PATCH] c++: one more PR114632 tweak Patrick points out that after the PR114632 fix we can also rever the change that moved cp_evaluated higher in tsubst_lambda_expr. gcc/cp/ChangeLog: * pt.cc (tsubst_lambda_expr): Revert r9-5971 change. --- gcc/cp/pt.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 8e175337b71..fd23be1fe26 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -20497,11 +20497,6 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) r = error_mark_node; else { - /* The body of a lambda-expression is not a subexpression of the - enclosing expression. Parms are to have DECL_CHAIN tsubsted, - which would be skipped if cp_unevaluated_operand. */ - cp_evaluated ev; - /* Fix the type of 'this'. For static and xobj member functions we use this to transport the lambda's closure type. It appears that in the regular case the @@ -20527,6 +20522,10 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) /* Let finish_function set this. */ DECL_DECLARED_CONSTEXPR_P (fn) = false; + /* The body of a lambda-expression is not a subexpression of the + enclosing expression. */ + cp_evaluated ev; + bool nested = cfun; if (nested) push_function_context (); -- 2.47.2