+2018-02-16 Marek Polacek <polacek@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84192
+ * constexpr.c (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't
+ set *jump_target to anything if jump_target is NULL.
+
2018-02-16 Jason Merrill <jason@redhat.com>
PR c++/84151 - unnecessary volatile load with static member.
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
lval,
non_constant_p, overflow_p);
- *jump_target = t;
+ if (jump_target)
+ *jump_target = t;
+ else
+ {
+ /* Can happen with ({ return true; }) && false; passed to
+ maybe_constant_value. There is nothing to jump over in this
+ case, and the bug will be diagnosed later. */
+ gcc_assert (ctx->quiet);
+ *non_constant_p = true;
+ }
break;
case SAVE_EXPR:
+2018-02-16 Marek Polacek <polacek@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84192
+ * g++.dg/cpp1y/constexpr-84192.C: New test.
+
2018-02-16 Martin Sebor <msebor@redhat.com>
PR c++/79064
--- /dev/null
+// PR c++/84192
+// { dg-do compile { target c++14 } }
+// { dg-options "" }
+
+bool
+f1 ()
+{
+ return ({ return true; }) && false; // { dg-error "could not convert" }
+}
+
+void
+f2 ()
+{
+ for (;;)
+ constexpr bool b = ({ break; false; }) && false; // { dg-error "statement is not a constant expression" }
+}
+
+constexpr bool
+f3 (int n)
+{
+ bool b = false;
+ for (int i = 0; i < n; i++)
+ b = ({ break; }); // { dg-error "void value not ignored as it ought to be" }
+ return b;
+}
+
+constexpr bool b = f3 (4);
+
+bool
+f4 ()
+{
+ constexpr bool b = ({ return true; }) && false; // { dg-error "could not convert" }
+ return false;
+}
+
+constexpr bool
+f5 (int x)
+{
+ constexpr bool b = ({ switch (x) case 0: true; }) && false; // { dg-error "could not convert" }
+ return false;
+}