import std.stdio;

void main()
{
        int[3][2] matrix = [ [1,11,111], [2,22,222] ];

        foreach(int[5] row; matrix) //if int[3], there is no error.
        {
             foreach(x; row)
                write(x, "  ");
                
             writeln();
        }
}

I get runtime error for the above code too.

Application error:
object.Exception@src/rt/arraycat.d(31): lengths don't match for array copy


Why didn't I get a compilation error? All the array sizes are known at compile time. Right?

Reply via email to