On 19/11/18 23:27, Jason Li wrote: > The *self-contained test* which does not depend on STL: > > #include <iostream> int *getPtr(int& x) { std::cout << "getPtr(" << x << > ")\n"; // Artificial side effect return &x; } int main() { int zero = 0, > one = 1; *getPtr(zero) = *getPtr(one); } > > // Similar tests can be done with other operators using this technique > > Expected stdout: > > getPtr(1) > getPtr(0) > > MinGW (with -std=c++17) stdout: > > getPtr(0) > getPtr(1) FWIW, I can reproduce this with MinGW GCC-6.3.0 [*], as per your info: > Version info: > > Operating system: Windows 10 Pro 1803, 17134.407 > > gcc version 6.3.0 (MinGW.org GCC-6.3.0-1) $ use mingw32-gcc-6.3.0 $ mingw32-g++ --std=c++17 foo.cc $ ./a.exe ; rstty getPtr(0) getPtr(1) However, with the *current* MinGW GCC-7.3.0 [*]: $ use mingw32-gcc-7.3.0 $ mingw32-g++ --std=c++17 foo.cc $ ./a.exe ; rstty getPtr(1) getPtr(0) and with my latest experimental MinGW GCC-8.2.0 [*]: $ use mingw32-gcc-8.2.0 $ mingw32-g++ --std=c++17 foo.cc $ ./a.exe ; rstty getPtr(1) getPtr(0) From the above, I deduce that this is an upstream GCC issue, resolved from the release of GCC-7 onwards, (at least since GCC-7.3.0). [*] All of my tests result from cross-compiling your sample code, and running it under wine; the "rstty" is a local hack to work around a wine bug, which trashes my TTY keymap configuration after running any wine process (directly) in my console. -- Regards, Keith. Public key available from keys.gnupg.net Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20181120/459550cc/attachment.sig>