constinit not working as expected in Visual Studio 2019 Update 16.10

This commit is contained in:
Max Golovanov 2021-06-02 15:43:50 -07:00
parent b650ea44b1
commit bc46fce1bd

View File

@ -508,9 +508,10 @@
#ifdef PROTOBUF_CONSTINIT #ifdef PROTOBUF_CONSTINIT
#error PROTOBUF_CONSTINIT was previously defined #error PROTOBUF_CONSTINIT was previously defined
#endif #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: // Our use of constinit does not yet work with GCC:
// https://github.com/protocolbuffers/protobuf/issues/8310 // https://github.com/protocolbuffers/protobuf/issues/8310
// Does not work yet with Visual Studio 2019 Update 16.10
#define PROTOBUF_CONSTINIT constinit #define PROTOBUF_CONSTINIT constinit
#elif __has_cpp_attribute(clang::require_constant_initialization) #elif __has_cpp_attribute(clang::require_constant_initialization)
#define PROTOBUF_CONSTINIT [[clang::require_constant_initialization]] #define PROTOBUF_CONSTINIT [[clang::require_constant_initialization]]