Bug 8189 – const ref foreach iteration too

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-06-03T03:49:00Z
Last change time
2013-03-06T16:17:52Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-06-03T03:49:37Z
void foo(const ref int x) {} // OK void main() { int x = 1; foo(x); const(int)[] array; foreach (ref const int i; array) {} // OK foreach (const ref int i; array) {} // error } DMD 2.060alpha, after Issue 3290 : test.d(7): Error: basic type expected, not ref test.d(7): Error: no identifier for declarator const(int) test.d(7): Error: found 'ref' when expecting ';' test.d(7): Error: found 'i' when expecting '.' following int test.d(7): Error: found ';' when expecting identifier following 'int.' test.d(7): Error: found 'array' when expecting ')' test.d(7): Error: found ')' instead of statement test.d(8): Error: unrecognized declaration
Comment #1 by bearophile_hugs — 2012-06-03T03:51:16Z
In a related issue I reported: void main() { const(int)[] array; foreach (const i; array) {} }
Comment #2 by bearophile_hugs — 2013-03-06T16:17:52Z
This was fixed time ago.