I was playing with some code and got a warning about dllimport in some headers. I looked around a bit and came up with this test case.
The warning seems to imply that dllimport is ignored on bar(), but looking at the output the call to bar() is indeed mangled with __imp prefix. I'm using MinGW g++ 4.2.1-dw2. ## begin df.cpp __attribute__((dllimport)) int bar(); class Foo { private: int foo(); friend __attribute__((dllimport)) int bar(); }; int Foo::foo() { return bar(); } ## end df.cpp D:> g++ -S df.cpp df.cpp:7: warning: 'int bar()' redeclared without dllimport attribute: previous dllimport ignored D:> g++ -v Using built-in specs. Target: mingw32 Configured with: ../gcc-4.2.1-2-src/configure --with-gcc --enable-libgomp --host =mingw32 --build=mingw32 --target=mingw32 --program-suffix=-dw2 --with-arch=i486 --with-tune=generic --disable-werror --prefix=/mingw --with-local-prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c+ +,fortran,objc,obj-c++,ad a --disable-win32-registry --disable-sjlj-exceptions --enable-libstdcxx-debug -- enable-cxx-flags=-fno-function-sections -fno-data-sections --enable-version-spec ific-runtime-libs --disable-bootstrap Thread model: win32 gcc version 4.2.1-dw2 (mingw32-2) -- Summary: Incorrect warning when applying dllimport to friend function Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sldev327 at softmagi dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34749