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.
11 lines
207 B
C
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);
|