]> gcc.gnu.org Git - gcc.git/commitdiff
c++: cast split_nonconstant_init return val to void
authorJason Merrill <jason@redhat.com>
Mon, 19 Sep 2022 17:17:41 +0000 (19:17 +0200)
committerJason Merrill <jason@redhat.com>
Sat, 1 Oct 2022 03:45:08 +0000 (23:45 -0400)
We were already converting the result of expand_vec_init_expr to void; we
need to do the same for split_nonconstant_init.

The test that I noticed this with no longer fails without it.

gcc/cp/ChangeLog:

* cp-gimplify.cc (cp_genericize_init): Also convert the result of
split_nonconstant_init to void.

gcc/cp/cp-gimplify.cc

index 735488887837fa8a67378d99f91758939f19f84c..cca3b9fea33b164d0d2aa687466ffd0142e0fcb1 100644 (file)
@@ -892,13 +892,9 @@ omp_cxx_notice_variable (struct cp_genericize_omp_taskreg *omp_ctx, tree decl)
 static void
 cp_genericize_init (tree *replace, tree from, tree to)
 {
+  tree init = NULL_TREE;
   if (TREE_CODE (from) == VEC_INIT_EXPR)
-    {
-      tree init = expand_vec_init_expr (to, from, tf_warning_or_error);
-
-      /* Make cp_gimplify_init_expr call replace_decl.  */
-      *replace = fold_convert (void_type_node, init);
-    }
+    init = expand_vec_init_expr (to, from, tf_warning_or_error);
   else if (flag_exceptions
           && TREE_CODE (from) == CONSTRUCTOR
           && TREE_SIDE_EFFECTS (from)
@@ -906,7 +902,16 @@ cp_genericize_init (tree *replace, tree from, tree to)
     {
       to = cp_stabilize_reference (to);
       replace_placeholders (from, to);
-      *replace = split_nonconstant_init (to, from);
+      init = split_nonconstant_init (to, from);
+    }
+
+  if (init)
+    {
+      if (*replace == from)
+       /* Make cp_gimplify_init_expr call replace_decl on this
+          TARGET_EXPR_INITIAL.  */
+       init = fold_convert (void_type_node, init);
+      *replace = init;
     }
 }
 
This page took 0.066604 seconds and 5 git commands to generate.