Created attachment 1774 [details] Сast nested array from static to dynamic. Version: v2.090.0
The cast from int[2][2] to int[][] is invalid - you cannot slice across multiple dimensions. import std.stdio; void main(string[] args) { int[2][2] e = [[1,2],[3,4]]; int[][] c = cast(int[][]) e; writeln(c.length); // 1 writeln(c[0].length); // 8589934593 int[2][] valid = e; // no cast needed writeln(valid); // [[1, 2], [3, 4]] } The length of a static array is only known at compile time while the length of a dynamic array is a runtime value. Hence c's length is set to some garbage from the stack.