Here, we were going down the wrong path in perform_member_init because of
the incorrect parens around the mem-initializer for the array. And then
cxx_eval_vec_init_1 didn't know what to do with a CONSTRUCTOR as the
initializer. For GCC 9, let's just fix the latter issue.
gcc/cp/ChangeLog
2020-03-02 Jason Merrill <jason@redhat.com>
PR c++/86917
* constexpr.c (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
+2020-03-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/86917
+ * constexpr.c (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
+
2020-03-02 Jason Merrill <jason@redhat.com>
PR c++/91953
unsigned HOST_WIDE_INT i;
tsubst_flags_t complain = ctx->quiet ? tf_none : tf_warning_or_error;
+ if (init && TREE_CODE (init) == CONSTRUCTOR)
+ return cxx_eval_bare_aggregate (ctx, init, lval,
+ non_constant_p, overflow_p);
+
/* For the default constructor, build up a call to the default
constructor of the element type. We only need to handle class types
here, as for a constructor to be constexpr, all members must be
--- /dev/null
+// PR c++/86917
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ constexpr A () : c (0) {}
+ static const A z;
+ unsigned c;
+};
+
+struct B
+{ // This should really be target { ! c++2a }
+ typedef A W[4]; // { dg-error "paren" "" { xfail *-*-* } .+1 }
+ constexpr B () : w ({ A::z, A::z, A::z, A::z }) {} // { dg-error "constant" "" { xfail *-*-* } }
+ W w;
+};
+
+struct C
+{
+ C ();
+ B w[1];
+};
+
+C::C () { }