]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: one more PR114632 tweak
authorJason Merrill <jason@redhat.com>
Thu, 24 Jul 2025 19:38:36 +0000 (15:38 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 24 Jul 2025 19:38:36 +0000 (15:38 -0400)
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

index 8e175337b71dd80ef97cf4f59f4de86ce7d05c48..fd23be1fe26299f048b8fd69b6a98c90ab88ba3e 100644 (file)
@@ -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 ();