-2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
+2020-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/93998
+ * constexpr.c (cxx_eval_constant_expression)
+ <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
+ *non_constant_p is true.
+
+2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
* coroutines.cc (finish_co_await_expr): Build co_await_expr
with unknown_type_node.
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1),
false,
non_constant_p, overflow_p);
- if (!*non_constant_p)
- /* Adjust the type of the result to the type of the temporary. */
- r = adjust_temp_type (TREE_TYPE (t), r);
+ if (*non_constant_p)
+ break;
+ /* Adjust the type of the result to the type of the temporary. */
+ r = adjust_temp_type (TREE_TYPE (t), r);
if (TARGET_EXPR_CLEANUP (t) && !CLEANUP_EH_ONLY (t))
ctx->global->cleanups->safe_push (TARGET_EXPR_CLEANUP (t));
r = unshare_constructor (r);
{
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0), false,
non_constant_p, overflow_p);
+ if (*non_constant_p)
+ break;
ctx->global->values.put (t, r);
if (ctx->save_exprs)
ctx->save_exprs->safe_push (t);
+2020-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/93998
+ * g++.dg/ext/pr93998.C: New test.
+
2020-03-03 Dennis Zhang <dennis.zhang@arm.com>
* gcc.target/arm/simd/bf16_cvt_1.c: New test.
--- /dev/null
+// PR c++/93998
+// { dg-do compile { target c++11 } }
+
+struct C
+{
+ constexpr bool operator== (C x) const noexcept { return v == x.v; }
+ int v;
+};
+
+int
+foo (const C a, const C b, bool c)
+{
+ return __builtin_expect (!!(a == b || c), 1) ? 0 : 1;
+}