The following MCVE gives a warning, using mingw-w64 4.9.2:
struct __declspec(dllimport) S
{
int foo() { return func(); }
int func();
void other_func();
};
inline int S::func() { return 1000; }
int main() {}
The warning is:
dt.cc:9:5: warning: 'int S::func()' redeclared without dllimport attribute
after being referenced with dll linkage
inline int S::func() { return 1000; }
^
My question is: what is the problem being reported exactly, and should I do anything about it (e.g. file a bug report)?
The warning goes away if I change int func();
to inline int func();
-- not sure what the significance of this is.
Background: This pattern occurs in many places in the C++ library called POCO. The class has some functions whose bodies are in a DLL (e.g. other_func
here) and some functions whose bodies occur in the header file (e.g. func
here).