When the attached file is compiled with a mingw32 build of GCC 4.3.0, the constructor definition for "foo" does not fully override the declaration in the struct which inherits the dllimport attribute, and a dllimport reference is incorrectly emitted. The member function "bar()" is provided as an example of correctly overriding the dllimport declaration; this issue only occurs with constructors and destructors.
Compilation command line and output: > g++ -c impoverride.cpp impoverride.cpp:8: warning: 'foo::foo()' redeclared without dllimport attribute: previous dllimport ignored impoverride.cpp:12: warning: 'void foo::bar()' redeclared without dllimport attr ibute: previous dllimport ignored > nm impoverride.o 00000000 b .bss 00000000 d .data 00000000 t .text 00000011 T __Z3depv 0000000c T __ZN3foo3barEv 00000006 T __ZN3fooC1Ev 00000000 T __ZN3fooC2Ev U __imp___ZN3fooC1Ev << Shouldn't be there! > g++ -v Using built-in specs. Target: mingw32 Configured with: ../../gcc-4.3.0-ehstatic/configure --prefix=/mingw --build=ming w32 --enable-languages=c,c++ --disable-nls --disable-win32-registry --enable-sjl j-exceptions --enable-libgomp --with-gmp=/d/cygdev/gccbuild/libsfor43/debug/gmp- install --with-mpfr=/d/cygdev/gccbuild/libsfor43/debug/mpfr-install --with-libic onv-prefix=/d/cygdev/gccbuild/libsfor43/debug/iconv-install --disable-werror --e nable-threads --enable-libstdcxx-debug --enable-cxx-flags='-fno-function-section s -fno-data-sections' --disable-symvers Thread model: win32 gcc version 4.3.0 (GCC) -- Summary: Con/de-structor definition fails to override dllimport declaration Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tdragon at tdragon dot net GCC build triplet: mingw32 GCC host triplet: mingw32 GCC target triplet: mingw32 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35921