Given following code:
struct B {int i[2];};
struct A {B b[2];};
int main() {
A{{0, 0}, {0, 0}}; //too many initializers for ‘A’
A{{0, 0}, B{0, 0}}; //too many initializers for ‘A’
A{B{0, 0}, {0, 0}};
A{B{0, 0}, B{0, 0}};
}
Why would the first two not compile? I think all four lines should mean the same thing since they're all one-to-one mapping?
(The test is compiled using g++ 13.2.0 -std=c++20.)
Let us look at
[dcl.init.aggr]/16:The parsing seems to go as follows: