Comment #0 by bearophile_hugs — 2010-12-28T02:20:57Z
This deprecated D2 code works with DMD 2.051:
typedef int[1][1] Mat;
void main() {
Mat m;
foreach (row; m) {}
}
But this alternative:
struct Mat {
int[1][1] a;
alias a this;
}
void main() {
Mat m;
foreach (row; m) {} // line 7
}
DMD 2.051 prints:
test.d(7): Error: cannot infer type for row
This is something that I'd like to see work, so structs+alias this are better usable as an alternative of typedef.