[Issue 8498] modifying foreach range iterator fails in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 3 08:08:53 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8498



--- Comment #2 from timon.gehr at gmx.ch 2012-09-03 08:09:07 PDT ---
(In reply to comment #1)
> 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.

Interestingly the original bug report/title wasn't as it explicitly took this
into account. :o)

-- 
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