https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85091
--- Comment #23 from Vadim Zeitlin <vz-gcc at zeitlins dot org> --- Just to confirm that this is not specific to MinGW-w64, I've attached the test case (and a preprocessed version of it) allowing to reproduce the same problem with Linux x86_64 version of g++ 7.3 (7.3.0-12 from Debian/Sid). Unlike the other test case, this one really requires both -Wnonnull and -Woverloaded-virtual to be specified to see the problem, so the commands to use are (I also switched to assembly because I figured this was simpler to compare than disassembling object files, but this is not significant): % g++-7 -S -std=c++17 -O2 gcc-7.3-x86_64-linux.cpp -o nowarn.s % g++-7 -S -std=c++17 -O2 gcc-7.3-x86_64-linux.cpp -Wnonnull -Woverloaded-virtual -o warn.s % diff -u nowarn.s warn.s|head --- nowarn.s 2018-03-27 17:11:31.841485730 +0000 +++ warn.s 2018-03-27 17:11:41.961553404 +0000 @@ -616,17 +616,15 @@ .LEHB19: call _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT .LEHE19: -.L89: - lock addl $1, _ZN8lmi_test4test20test_tools_successesE(%rip) popq %rbx .cfi_remember_state ("head" is used because there are plenty of other insignificant differences due to the labels renumbering later). Please let me know if I can do anything else.