[PATCH] D80433: [clang-tblgen][CommandLine][ManagedStatic] Fix build errors with clang-tblgen in Debug mode using MSVC 2019 v16.6

Denys Petrov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 22 09:06:03 PDT 2020


ASDenysPetrov updated this revision to Diff 265749.
ASDenysPetrov added a comment.

Updated


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80433/new/

https://reviews.llvm.org/D80433

Files:
  llvm/include/llvm/Support/ManagedStatic.h


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
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80433.265749.patch
Type: text/x-patch
Size: 953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200522/a5604ec4/attachment.bin>


More information about the llvm-commits mailing list