https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85091
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- I can't reproduce this with: gcc version 7.2.0 20170814 (Fedora MinGW 7.2.0-1.fc26) (GCC) I get one warning: $ i686-w64-mingw32-g++ -c -std=c++17 -Wnonnull -Woverloaded-virtual -O2 16795.cpp 16795.cpp: In function 'unsigned int _get_output_format()': 16795.cpp:316:25: warning: 'unsigned int _get_output_format()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] extern "C" unsigned int _get_output_format(void) {return 1;} ^~~~~~~~~~~~~~~~~~ But no different code depending on the warning options used.