commit b77241e3be8b3eb4247d07e2f2967cbb585e08bc
Author: Jason Merrill <jason@redhat.com>
Date: Fri Feb 21 14:37:17 2014 -0500
PR c++/60186
* typeck2.c (massage_init_elt): Call fold_non_dependent_expr_sfinae.
@@ -1131,7 +1131,10 @@ massage_init_elt (tree type, tree init, tsubst_flags_t complain)
init = TARGET_EXPR_INITIAL (init);
/* When we defer constant folding within a statement, we may want to
defer this folding as well. */
- init = maybe_constant_init (init);
+ tree t = fold_non_dependent_expr_sfinae (init, complain);
+ t = maybe_constant_value (t);
+ if (TREE_CONSTANT (t))
+ init = t;
return init;
}
new file mode 100644
@@ -0,0 +1,7 @@
+// PR c++/60186
+// { dg-require-effective-target c++11 }
+
+template<typename> void foo(int i)
+{
+ constexpr int a[] = { i }; // { dg-error "" }
+}