[Issue 4090] No foreach type inference with const, ref etc modifiers
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 7 04:47:46 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4090
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
--- Comment #15 from bearophile_hugs at eml.cc 2012-11-07 04:47:43 PST ---
Now this code:
void main() {
int[] array = [10, 20, 30];
foreach (const i, x; array) i++;
foreach (immutable i, x; array) i++;
}
Gives:
test.d(3): Warning: variable modified in foreach body requires ref storage
class
test.d(3): Error: cannot modify const expression i
test.d(4): Warning: variable modified in foreach body requires ref storage
class
test.d(4): Error: cannot modify immutable expression i
Why is it giving both the warning and the error?
Closed again. Thank you Hara and others.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list