Struct initializers do not work inside array initializers (outside constants)
All of the following initializers do work, except for the last one:
struct Foo { int a; int b; }
void main() {
const Foo MY_FOO = {0, 1};
const int[] MY_INTS = {0, 1};
const int[,] MY_INTSS = {{0, 1}, {2, 3}};
const Foo[] MY_FOOS = {{0, 1}, {2, 3}};
Foo my_foo = {0, 1};
int[] my_ints = {0, 1};
int[,] my_intss = {{0, 1}, {2, 3}};
Foo[] my_foos = {{0, 1}, {2, 3}};
}
Displayed error:
initializer_in_array.vala:11.20-11.25: error: Expected array element, got array initializer list
Foo[] my_foos = {{0, 1}, {2, 3}};
^^^^^^
Compilation failed: 1 error(s), 0 warning(s)
Edited by Marvin W