The other way of fixing this is by using ... macros. The article at c++ - Importing inline functions in MinGW - Stack Overflow<https://stackoverflow.com/questions/11546403/importing-inline-functions-in-mingw> mentions using inline in the class declaration.
Their example works fine with both GCC MinGW and Clang MinGW. Visual C++ is also fine: #ifdef _WIN32 #define Q_EXPORT_INLINE inline #else #define Q_EXPORT_INLINE #endif class __declspec(dllimport) MyClass { public: Q_EXPORT_INLINE int myFunc2(); Q_EXPORT_INLINE int myFunc1(); }; inline int MyClass::myFunc2(void) { return myFunc1(); } inline int MyClass::myFunc1(void) { return 0; } Cheers, Cristian ________________________________ From: Development <development-boun...@qt-project.org> on behalf of Kai Köhne via Development <development@qt-project.org> Sent: Friday, August 25, 2023 11:28 To: development@qt-project.org <development@qt-project.org>; Hasselmann Mathias <math...@taschenorakel.de> Subject: Re: [Development] On the use of the inline keyword Not an GCC expert, but this is the code that emits the warning in GCC: https://github.com/gcc-mirror/gcc/blob/66be6ed81f369573824f1a8f5a3538a63472292f/gcc/attribs.cc#L1818 First argument for warning() is 0 ... which explains why it cannot be easily disabled with say -Wno-ignored-attributes. I therefore don't see an easy way to disable this specific warning. Regards ________________________________________ From: Development <development-boun...@qt-project.org> on behalf of Hasselmann Mathias via Development <development@qt-project.org> Sent: Friday, August 25, 2023 10:34 To: development@qt-project.org Subject: Re: [Development] On the use of the inline keyword Am 24.08.2023 um 21:42 schrieb Thiago Macieira: > That warning looks like a bug in the compiler instead. So if there's no ill- > effect, I'd just disable and ignore it. Seems like an easy fix, but breaks user code that explicitly enables this warning. Guess ignoring is not a good option, if one cares about user experience. Ciao Mathias -- Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development -- Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
-- Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development