void foo(out int[2][2] m) {} void main() { int[2][2] mat = [[1, 2], [3, 4]]; foo(mat); } DMD 2.055head gives: test.d(1): Error: cannot implicitly convert expression (0) of type int to int[2u][]
What is the problem ? I think this is an appropriate error message.
(In reply to comment #1) > What is the problem ? I think this is an appropriate error message. How do you work that out???
(In reply to comment #2) > (In reply to comment #1) > > What is the problem ? I think this is an appropriate error message. > > How do you work that out??? I may be completely wrong, but I would imagine {} is equivalent to {return;} which by default returns an int ?? I agree it's a bit fetched, but the test code too.
(In reply to comment #3) > I may be completely wrong, but I would imagine {} is equivalent to > {return;} which by default returns an int ?? Where do you get that idea from? return; returns void. As does reaching the end of a function with void return type without hitting a return statement. Back to your original comment, where do you see a 0 in the reporter's code, let alone an attempt to convert one to an int[2u][]?
Fixed in 2.065.
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/838abc6a84aca89d2f6b356e1f37977f63968730 fix Issue 6565 - out 2D fixed-sized array
Commit pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/838abc6a84aca89d2f6b356e1f37977f63968730 fix Issue 6565 - out 2D fixed-sized array