[PATCH v2] c++: direct-init of an array of class type [PR59465]

Stephan Bergmann sberg.fun@gmail.com
Mon Mar 25 11:36:46 GMT 2024


On 3/21/24 10:28 PM, Jason Merrill wrote:
> On 3/21/24 16:48, Marek Polacek wrote:
>> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
> 
> OK.

This started to break

> $ cat test.cc
> struct S1 { S1(); };
> struct S2 {
>     S2() {}
>     S1 a[1] {};
> };

> $ g++ -fsyntax-only test.cc
> test.cc: In constructor ‘S2::S2()’:
> test.cc:3:10: error: invalid initializer for array member ‘S1 S2::a [1]’
>     3 |     S2() {}
>       |          ^




More information about the Gcc-patches mailing list