From bc46fce1bd776c42c27769857eebf1382d5c74f4 Mon Sep 17 00:00:00 2001 From: Max Golovanov Date: Wed, 2 Jun 2021 15:43:50 -0700 Subject: [PATCH] constinit not working as expected in Visual Studio 2019 Update 16.10 --- src/google/protobuf/port_def.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 55012521703c..f4ce030bd1f2 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -508,9 +508,10 @@ #ifdef PROTOBUF_CONSTINIT #error PROTOBUF_CONSTINIT was previously defined #endif -#if defined(__cpp_constinit) && !PROTOBUF_GNUC_MIN(3, 0) +#if defined(__cpp_constinit) && !PROTOBUF_GNUC_MIN(3, 0) && !defined(_MSC_VER) // Our use of constinit does not yet work with GCC: // https://github.com/protocolbuffers/protobuf/issues/8310 +// Does not work yet with Visual Studio 2019 Update 16.10 #define PROTOBUF_CONSTINIT constinit #elif __has_cpp_attribute(clang::require_constant_initialization) #define PROTOBUF_CONSTINIT [[clang::require_constant_initialization]]