The specification at http://dlang.org/expression.html says these things: "The following binary expressions are evaluated in an implementation-defined order: ... function arguments" "The evaluation order of function arguments is defined to be left to right." "Note that dmd currently does not comply with left to right evaluation of function arguments." So, if I'm reading this correctly, the spec doesn't agree with itself, and what it says doesn't matter anyways because the compiler doesn't implement it?
A long standing issue. Function arguments should be LTR. Pull request is available, but blocked as it needs a final decision by Walter or Andrei for the evaluation order of (all kinds of) assign expressions. Currently blocked PR: https://github.com/D-Programming-Language/dmd/pull/4035 History/Reference: http://bugzilla.gdcproject.org/show_bug.cgi?id=8 http://forum.dlang.org/thread/bniaxycuguviwfdtojzf@forum.dlang.org https://github.com/D-Programming-Language/dlang.org/pull/6 https://github.com/D-Programming-Language/dlang.org/pull/669 https://github.com/D-Programming-Language/dmd/pull/4035 https://issues.dlang.org/show_bug.cgi?id=6620 BTW: The spec doesn't really contradict itself: "_are_ evaluated in an implementation-defined order: ... function arguments"" is what _does_ happen. "The evaluation order of function arguments is _defined_ to be left to right." is what _should_ happen. "Note that dmd currently does not comply with left to right evaluation of function arguments." explains the difference.