http://d.puremagic.com/issues/show_bug.cgi?id=6652
--- Comment #4 from d...@dawgfoto.de 2011-09-13 00:02:29 PDT --- https://github.com/D-Programming-Language/dmd/pull/377 Foreach arguments behave like function arguments. Here they don't. The variable can be optimized out, if no altering happens. This will not happen in a debug build, where it is irrelevant in comparison to every variable being accessed through the stack. You can use ref, if you're having too expensive copies foreach(ref const i; iter(0) .. iter(10)) as with every other foreach argument. Most important it has an explicit rule, that one can alter the loop index through using a ref index. foreach(ref idx, v; [0, 1, 2, 3, 4, 5]) idx += stride - 1; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------