Index: llvm/include/llvm/Support/ManagedStatic.h =================================================================== --- llvm/include/llvm/Support/ManagedStatic.h +++ llvm/include/llvm/Support/ManagedStatic.h @@ -40,8 +40,11 @@ // constexpr, a dynamic initializer may be emitted depending on optimization // settings. For the affected versions of MSVC, use the old linker // initialization pattern of not providing a constructor and leaving the fields -// uninitialized. -#if !defined(_MSC_VER) || defined(__clang__) +// uninitialized. This bug was fixed in VS2019 ver16.5 +// (https://developercommunity.visualstudio.com/content/problem/262083/compiler-emits-dynamic-initializer-for-variable-wi.html). +// Check MSVC version here +// (https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?redirectedfrom=MSDN&view=vs-2019). +#if (defined(_MSC_VER) && (_MSC_VER >= 1925)) || defined(__clang__) #define LLVM_USE_CONSTEXPR_CTOR #endif