[Issue 8498] modifying foreach range iterator fails in CTFE
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 3 00:52:15 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8498
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |CTFE, wrong-code
CC| |clugdbug at yahoo.com.au
Summary|inconsistent foreach |modifying foreach range
|behaviour in CTFE and at |iterator fails in CTFE
|runtime |
--- Comment #1 from Don <clugdbug at yahoo.com.au> 2012-09-03 00:52:40 PDT ---
Here's a reduced test case. There are 10 iterations, even though the iteration
variable is changed.
int fun(){
int r=0;
foreach(i;0..10) {
++r;
i= 100;
assert(i==100); // ok -- but doesn't affect the foreach
}
return r;
}
static assert(fun() == 1);
Interestingly this is in direct conflict with enhancement bug 6214, which asks
for the behaviour we see in CTFE to be used at run time.
--
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