https://issues.dlang.org/show_bug.cgi?id=13670
Jonathan M Davis <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] | |m --- Comment #1 from Jonathan M Davis <[email protected]> --- So, essentially, you want to do something like a[i] = i++ and have that be equivalent to i++; a[i] = i; In C++, a[i] = i++; the order of evaluation is undefined, so it results in undefined behavior. AFAIK, this is also the case in D. Making it so that the order of evaluation is always left-to-right has been discussed, but AFAIK, it's not actually what the language currently does or the spec requires. It may be that that will change in the future, but I don't know. Regardless, I'd advise that you avoid any code where you mutate a variable in an expression and then use that same variable elsewhere in the expression. Even if the order of evaluation does get defined in D at some point in the future, it won't be in other languages, so getting in the habit of relying on it is probably a bad idea. In any case, AFAIK, your example does not currently count as a bug. --
