On 7/24/25 2:43 PM, Patrick Palka wrote:
On Thu, 24 Jul 2025, Jason Merrill wrote:
The lambda conversion was ICEing for two C++23 features, static op() and
explicit object parameters. The issue with the former seems like a more
general issue: tsubst_function_decl recursing to substitute the parameters
was affected by cp_unevaluated_operand from the decltype that refers to the
declaration. Various places already make a point of clearing
cp_unevaluated_operand ahead of PARM_DECL tsubsting; doing it here makes the
PR101233 fix redundant.
Shall we also partially revert r9-5971-g60378a964a2a6b by moving down
the cp_evaluated in tsubst_lambda_expr to just before tsubsting the body
of the lambda so that it better reflects its comment?
I wasn't going to bother, but sure, pushing thus:
From 6184fb5fd935adbf28cb60f134c215682031c8c3 Mon Sep 17 00:00:00 2001
From: Jason Merrill <ja...@redhat.com>
Date: Thu, 24 Jul 2025 15:01:09 -0400
Subject: [PATCH] c++: one more PR114632 tweak
To: gcc-patches@gcc.gnu.org
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.50.1