Hi,
this ICE - which leads to worse diagnostics - seems caused by a trivial
typo: to mean value initialization diagnose_non_constexpr_vec_init is
passing zoid_zero_node instead of void_type_node to build_vec_init_elt.
My guess is also confirmed by the beginning of the other caller,
build_vec_init_expr, which evidently has void_type_node meaning value
initialization.
The below tested x86_64-linux.
Thanks,
Paolo.
///////////////////
/cp
2011-12-20 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51621
* tree.c (diagnose_non_constexpr_vec_init): For value initialization
pass void_type_node, not void_zero_node, to build_vec_init_elt.
/testsuite
2011-12-20 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51621
* g++.dg/cpp0x/constexpr-ice5.C: New.
Index: testsuite/g++.dg/cpp0x/constexpr-ice5.C
===================================================================
--- testsuite/g++.dg/cpp0x/constexpr-ice5.C (revision 0)
+++ testsuite/g++.dg/cpp0x/constexpr-ice5.C (revision 0)
@@ -0,0 +1,13 @@
+// PR c++/51621
+// { dg-options -std=c++0x }
+
+struct A
+{
+ A() {}
+};
+
+struct B
+{
+ A a[1];
+ constexpr B() : a() {} // { dg-error "non-constant|non-constexpr" }
+};
Index: cp/tree.c
===================================================================
--- cp/tree.c (revision 182525)
+++ cp/tree.c (working copy)
@@ -564,7 +564,7 @@ diagnose_non_constexpr_vec_init (tree expr)
tree type = TREE_TYPE (VEC_INIT_EXPR_SLOT (expr));
tree init, elt_init;
if (VEC_INIT_EXPR_VALUE_INIT (expr))
- init = void_zero_node;
+ init = void_type_node;
else
init = VEC_INIT_EXPR_INIT (expr);