PR c++/92343
* constexpr.c (potential_constant_expression_1): Return true rather
than false for PREDICT_EXPR.
* g++.dg/cpp2a/attr-likely6.C: New test.
From-SVN: r277819
2019-11-05 Jakub Jelinek <jakub@redhat.com>
+ PR c++/92343
+ * constexpr.c (potential_constant_expression_1): Return true rather
+ than false for PREDICT_EXPR.
+
* decl.c (omp_declare_variant_finalize_one): Call
declare_simd_adjust_this not just on the context, but also on the
variant-id expression for methods. Don't call
case LABEL_DECL:
case LABEL_EXPR:
case CASE_LABEL_EXPR:
+ case PREDICT_EXPR:
case CONST_DECL:
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
return true;
case EMPTY_CLASS_EXPR:
- case PREDICT_EXPR:
return false;
case GOTO_EXPR:
+2019-11-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/92343
+ * g++.dg/cpp2a/attr-likely6.C: New test.
+
2019-11-05 Martin Liska <mliska@suse.cz>
PR c++/92339
--- /dev/null
+// PR c++/92343
+// { dg-do compile { target c++14 } }
+
+constexpr bool
+foo (bool x)
+{
+ if (x)
+ [[unlikely]] return true;
+ else
+ [[likely]] return false;
+}
+
+static_assert (foo (true), "");
+static_assert (!foo (false), "");