https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94156
Павел Тюнин <pavel51tunin at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pavel51tunin at gmail dot com --- Comment #2 from Павел Тюнин <pavel51tunin at gmail dot com> --- Created attachment 49391 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49391&action=edit minimal sample to reproduce the bug This sample triggers this or similar bug on both mingw 9.2.0 and mingw-w64 10.2.1. Compilation log: D:\test>g++ -O2 -flto -c test1.cpp D:\test>g++ -O2 -flto -c test2.cpp D:\test>g++ -flto -o test.exe test1.o test2.o D:/mingw-w64/mingw/bin/../lib/gcc/i686-w64-mingw32/10.2.1/../../../../i686-w64-m ingw32/bin/ld.exe: test2.o (symbol from plugin):(.gnu.linkonce.t._ZN7Derived3foo Ev[__ZThn4_N7Derived3fooEv]+0x0): multiple definition of `Derived::foo()'; test1 .o (symbol from plugin):(.gnu.linkonce.t._ZN7Derived3fooEv[__ZThn8_N7Derived3foo Ev]+0x0): first defined here D:/mingw-w64/mingw/bin/../lib/gcc/i686-w64-mingw32/10.2.1/../../../../i686-w64-m ingw32/bin/ld.exe: test2.o (symbol from plugin):(.gnu.linkonce.t._ZN7Derived3foo Ev[__ZThn4_N7Derived3fooEv]+0x0): multiple definition of `non-virtual thunk to D erived::foo()'; test1.o (symbol from plugin):(.gnu.linkonce.t._ZN7Derived3fooEv[ __ZThn8_N7Derived3fooEv]+0x0): first defined here D:/mingw-w64/mingw/bin/../lib/gcc/i686-w64-mingw32/10.2.1/../../../../i686-w64-m ingw32/bin/ld.exe: test2.o (symbol from plugin):(.gnu.linkonce.t._ZN7Derived3foo Ev[__ZThn4_N7Derived3fooEv]+0x0): multiple definition of `non-virtual thunk to D erived::foo()'; test1.o (symbol from plugin):(.gnu.linkonce.t._ZN7Derived3fooEv[ __ZThn8_N7Derived3fooEv]+0x0): first defined here collect2.exe: error: ld returned 1 exit status