Comment #0 by bearophile_hugs — 2011-09-07T00:57:03Z
In this program the Foo struct is large, so I use ref to avoid its copies. I also use const because I want to make sure (and document) the two loops will not change the matrix contents:
struct Foo { int[1000] a; }
void bar(ref Foo x) {}
void main() {
auto m = new Foo[][](3, 3);
foreach (const(Foo[]) row; m)
foreach (ref const(Foo) x; row)
bar(x);
}
But I'd like type inference there, and be able to write something like:
struct Foo { int[1000] a; }
void bar(ref Foo x) {}
void main() {
auto m = new Foo[][](3, 3);
foreach (const row; m)
foreach (ref const x; row)
bar(x);
}
With DMD 2.055beta3 this gives:
test.d(5): no identifier for declarator const(row)
test.d(6): no identifier for declarator const(x)
Comment #1 by yebblies — 2011-09-07T01:14:50Z
You're kidding me right? This is the THIRD time you've reported this exact bug.
*** This issue has been marked as a duplicate of issue 4090 ***
Comment #2 by bearophile_hugs — 2011-09-07T02:07:39Z
I am sorry.
Comment #3 by yebblies — 2011-09-07T02:15:27Z
(In reply to comment #2)
> I am sorry.
Just don't forget to do a quick search first next time!
I know you have over 200 enhancement requests open, but it might be worth going through and checking they all still make sense.