[pushed] c++: correct fold_operand change

Message ID 20221025180506.108938-1-jason@redhat.com
State Accepted
Headers
Series [pushed] c++: correct fold_operand change |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Jason Merrill Oct. 25, 2022, 6:05 p.m. UTC
  Tested x86_64-pc-linux-gnu, applying to trunk.

-- >8 --

Still want the conversion to bool.

gcc/cp/ChangeLog:

	* constexpr.cc (find_failing_clause_r): Re-add the call to
	contextual_conv_bool.
---
 gcc/cp/constexpr.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


base-commit: e6a29aab51122103e677ffed523371c9c816ec98
  

Patch

diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 39bb023b79c..15b4f2c4a08 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -1887,7 +1887,8 @@  find_failing_clause_r (const constexpr_ctx *ctx, tree expr)
 	e = find_failing_clause_r (ctx, TREE_OPERAND (expr, 1));
       return e;
     }
-  tree e = fold_operand (expr, ctx);
+  tree e = contextual_conv_bool (expr, tf_none);
+  e = fold_operand (e, ctx);
   if (integer_zerop (e))
     /* This is the failing clause.  */
     return expr;