[llvm-dev] [UPDATE] Disabling inline compilation (Clang with VS2019)

John Emmas via llvm-dev
Wed, 08 Dec 2021 09:51:43 -0000

On 07/12/2021 16:12, Hans Wennborg wrote:
> Adding a note here:https://reviews.llvm.org/D115252
>

Many thanks everyone,

So if I'm understanding this correctly, the difference in my original
example below must be that (for MSVC) a static class member variable
gets categorized as if it was a global variable - whereas (for Clang) it
doesn't?

John

On 22/09/2021 13:22, John Emmas wrote:
>
> #if defined (BUILDING_DLL)
>   #define DLL_API __declspec(dllexport)
> #else
>   #define DLL_API __declspec(dllimport)
> #endif
>
> namespace Gtkmm2ext {
>
>   class DLL_API Keyboard
>   {
>     public:
>       Keyboard ();
>       ~Keyboard ();
>
>       static Keyboard& get_keyboard() { return *_the_keyboard; } //
> <--- inlined by clang but not by msvc
>
>     protected:
>       static Keyboard* _the_keyboard;
>   };
>
> } /* namespace */
>