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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
It appears that cp_fold isn't handling UNARY_PLUS_EXPR properly.  I've modified
the code according to the UNARY_PLUS_EXPR handling in
cxx_eval_constant_expression like this:

--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -2009,6 +2009,8 @@ cp_fold (tree x)
      else
        x = fold_build1_loc (loc, code, TREE_TYPE (x), op0);
    }
+      else if (code == UNARY_PLUS_EXPR)
+   x = fold_convert (TREE_TYPE (x), op0);
       else
    x = fold (x);

and that seems to fix the problem.

Reply via email to