[Bug c++/84684] inserting random code / flags produces wrong code

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 5 17:27:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84684

--- Comment #15 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think this is the fix:

--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1251,8 +1251,7 @@ massage_init_elt (tree type, tree init, int nested,
tsubst_flags_t complain)
     init = TARGET_EXPR_INITIAL (init);
   /* When we defer constant folding within a statement, we may want to
      defer this folding as well.  */
-  tree t = fold_non_dependent_expr (init);
-  t = maybe_constant_init (t);
+  tree t = fold_non_dependent_init (init);
   if (TREE_CONSTANT (t))
     init = t;
   return init;

(implementation of fold_non_dependent_init intentionally omitted here).


More information about the Gcc-bugs mailing list