This used to compile: --- struct S { int[2][1] a21; } void main() { S s = S([1, 2]); // Error: cannot implicitly convert expression ([1, 2]) of type int[] to int[2u][1u] } --- Not sure about validity of the issue as documentation doesn't provide exact implicit conversions on struct initialization.
> Not sure about validity of the issue as documentation doesn't provide exact implicit conversions on struct initialization. I'm not sure either. struct S { int [2][1] xx = [1, 2]; } prints: test.d(3): Error: array initializer has 2 elements, but array length is 1. So the struct literal behaviour is consistent with that. Yet, void main() { int [2][1] xx = [1, 2]; } is accepted. I think the difference in behaviour is hard to justify.
https://github.com/D-Programming-Language/dmd/pull/2611
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d4638f1f70c602987f1e0cab62818d399b64a219 fix Issue 11105 - Error on struct with multidimentional static array initialization from its element https://github.com/D-Programming-Language/dmd/commit/efcd62c6d5c1ac1b59cba6c5eb546803c2c5931f Merge pull request #2611 from 9rnsr/fix11105 [REG2.064a] Issue 11105 - Error on struct with multidimentional static array initialization from its element