I figured out something weird. The variable 'i' is passed by reference, yet the variable 'i' of the loop isn't being incremented by posfunc. I assume foreach creates a new i variable at the start of each new loop.
Yep:
``` $ rdmd --eval 'foreach (i; 0 .. 5) { writeln(i); i++; }' 0 1 2 3 4 ```