]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: always walk DECL_VALUE_EXPR in cp_genericize_r [PR121500]
authorPatrick Palka <ppalka@redhat.com>
Sat, 9 May 2026 13:01:11 +0000 (09:01 -0400)
committerPatrick Palka <ppalka@redhat.com>
Sat, 9 May 2026 13:01:11 +0000 (09:01 -0400)
This patch makes cp_genericize_r unconditionally walk DECL_VALUE_EXPR
as per the TODO from r16-7523.

PR c++/121500

gcc/cp/ChangeLog:

* cp-gimplify.cc (cp_genericize_r): Unconditionally walk
DECL_VALUE_EXPR.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/cp-gimplify.cc

index 85a3e98100f6c993909bda43fadd9d4df01c84f9..6845134c01d129c3ea9b916fe79d66ef62064f93 100644 (file)
@@ -1955,13 +1955,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
   if ((TREE_CODE (stmt) == VAR_DECL
        || TREE_CODE (stmt) == PARM_DECL
        || TREE_CODE (stmt) == RESULT_DECL)
-      && DECL_HAS_VALUE_EXPR_P (stmt)
-      /* Walk DECL_VALUE_EXPR mainly for benefit of xobj lambdas so that we
-        adjust any invisiref object parm uses within the capture proxies.
-        TODO: For GCC 17 do this walking unconditionally.  */
-      && current_function_decl
-      && DECL_XOBJ_MEMBER_FUNCTION_P (current_function_decl)
-      && LAMBDA_FUNCTION_P (current_function_decl))
+      && DECL_HAS_VALUE_EXPR_P (stmt))
     {
       tree ve = DECL_VALUE_EXPR (stmt);
       cp_walk_tree (&ve, cp_genericize_r, data, NULL);