8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-array24.C
Jason Merrill 0712ea6313 c++: Fix constexpr vs. omitted aggregate init.
Value-initialization is importantly different from {}-initialization for
this testcase, where the former calls the deleted S constructor and the
latter initializes S happily.

	PR c++/90951
	* constexpr.c (cxx_eval_array_reference): {}-initialize missing
	elements instead of value-initializing them.
2020-02-04 17:22:15 -05:00

11 lines
207 B
C

// PR c++/90951
// { dg-do compile { target c++11 } }
#define assert(expr) static_assert (expr, #expr)
struct S { const char a[2]; };
constexpr struct S a[1][1][1] = { };
assert ('\0' == *a[0][0][0].a);