Bug 6565 – out 2D fixed-sized array

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-08-27T19:26:00Z
Last change time
2015-06-17T21:04:02Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-08-27T19:26:14Z
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][]
Comment #1 by lovelydear — 2012-04-27T10:03:12Z
What is the problem ? I think this is an appropriate error message.
Comment #2 by smjg — 2012-04-28T04:40:58Z
(In reply to comment #1) > What is the problem ? I think this is an appropriate error message. How do you work that out???
Comment #3 by lovelydear — 2012-04-28T04:58:34Z
(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.
Comment #4 by smjg — 2012-04-28T05:09:18Z
(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][]?
Comment #5 by k.hara.pg — 2015-01-09T09:24:45Z
Fixed in 2.065.
Comment #6 by github-bugzilla — 2015-04-02T13:14:29Z
Comment #7 by github-bugzilla — 2015-06-17T21:04:02Z