As of DMD 2.100.0-rc.1, the following program causes an AssertError at runtime: --- int global = 0; int[2] f() { global++; return [123, 456]; } void g(int a, int b) {} void main() { g(f().tupleof); assert(global == 1); } --- The error is: --- core.exception.AssertError@bug.d(14): 2 != 1 --- This happens because the expression `f().tupleof` is erroneously expanded to `f()[0].tupleof, f()[1].tupleof`, which results in `f` being called twice instead of once.
@pbackus created dlang/dmd pull request #14068 "Fix Issue 23083 - .tupleof on static array rvalue evaluates expressio…" fixing this issue: - Fix Issue 23083 - .tupleof on static array rvalue evaluates expression multiple times https://github.com/dlang/dmd/pull/14068
dlang/dmd pull request #14068 "Fix Issue 23083 - .tupleof on static array rvalue evaluates expressio…" was merged into stable: - 76710fd0143f6b97c930be319f777af4bf1c29ca by Paul Backus: Fix Issue 23083 - .tupleof on static array rvalue evaluates expression multiple times https://github.com/dlang/dmd/pull/14068