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

--- Comment #12 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Candidate fix:

--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -1072,7 +1072,7 @@ cp_fold_immediate_r (tree *stmt_p, int *walk_subtrees,
void *data_)
       /* We're done here.  Don't clear *walk_subtrees here though: we're
called
     from cp_fold_r and we must let it recurse on the expression with
     cp_fold.  */
-      break;
+      return integer_zero_node;
     case PTRMEM_CST:
       if (TREE_CODE (PTRMEM_CST_MEMBER (stmt)) == FUNCTION_DECL
      && DECL_IMMEDIATE_FUNCTION_P (PTRMEM_CST_MEMBER (stmt)))
@@ -1145,7 +1145,8 @@ cp_fold_immediate (tree *tp, mce_value
manifestly_const_eval)
     flags |= ff_mce_false;

   cp_fold_data data (flags);
-  return !!cp_walk_tree_without_duplicates (tp, cp_fold_immediate_r, &data);
+  tree r = cp_walk_tree_without_duplicates (tp, cp_fold_immediate_r, &data);
+  return r == error_mark_node;
 }

 /* Perform any pre-gimplification folding of C++ front end trees to

Reply via email to