2017-02-06 Jakub Jelinek <jakub@redhat.com>
+ PR c++/79379
+ * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
+ (potential_constant_expression_1): Likewise.
+
PR c++/79377
* tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
allow one fewer than expected arguments if flag_permissive.
*non_constant_p = true;
return t;
+ case ANNOTATE_EXPR:
+ gcc_assert (tree_to_uhwi (TREE_OPERAND (t, 1)) == annot_expr_ivdep_kind);
+ r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
+ lval,
+ non_constant_p, overflow_p,
+ jump_target);
+ break;
+
default:
if (STATEMENT_CODE_P (TREE_CODE (t)))
{
return false;
}
+ case ANNOTATE_EXPR:
+ gcc_assert (tree_to_uhwi (TREE_OPERAND (t, 1)) == annot_expr_ivdep_kind);
+ return RECUR (TREE_OPERAND (t, 0), rval);
+
default:
if (objc_is_property_ref (t))
return false;
2017-02-06 Jakub Jelinek <jakub@redhat.com>
+ PR c++/79379
+ * g++.dg/cpp1y/constexpr-79379.C: New test.
+
PR c++/79377
* g++.dg/lookup/pr79377.C: New test.
--- /dev/null
+// PR c++/79379
+// { dg-do compile { target c++14 } }
+// { dg-options "-O2" }
+
+template <int N>
+constexpr int
+foo (int x)
+{
+ int q[64] = { 0 }, r = 0;
+#pragma GCC ivdep
+ for (int i = 0; i < x; ++i)
+ q[i] += 2;
+ for (int i = 0; i < x; ++i)
+ r += q[i];
+ return r + N;
+}
+
+constexpr int a = foo<0> (17);
+static_assert (a == 34, "");