version (none) { extern(C) int bar(int a, int b) { return b - a; } } else { int bar(int a, int b) { return b - a; } } void main() { int i; assert(bar(++i, ++i) == 1); } --- I know argument evaluation order isn't really guaranteed to be left to right. But having a reverse order for extern(C) calls is simply surprising.
(In reply to comment #0) > I know argument evaluation order isn't really guaranteed to be left to right. It isn't guaranteed _at all_, it's undefined. I think there's already an enhancement open about defining the order of evaluation, but until that's accepted this is perfectly valid behavior by the compiler.
The pull request was accepted, LTR evaluation is now required: https://github.com/D-Programming-Language/dlang.org/pull/6
https://github.com/D-Programming-Language/dmd/pull/4035
(In reply to Kenji Hara from comment #3) > https://github.com/D-Programming-Language/dmd/pull/4035 A small supplemental documentation fix: https://github.com/D-Programming-Language/dlang.org/pull/669
2.074.1: Failure with output: ----- core.exception.AssertError@onlineapp.d(13): Assertion failure ---------------- ??:? _d_assertp [0x42750d] onlineapp.d:13 _Dmain [0x427447] ??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFNlZv [0x427857] ??:? scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x427787] ??:? scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x427800] ??:? scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x427787] ??:? _d_run_main [0x4276f7] ??:? main [0x42746d] ??:? __libc_start_main [0x4218982f] ----- Since 2.075.1: Success and no output