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