Merge pull request #8690 from maxgolov/maxgolov/vs2019_16.10_constinit_broken

constinit not working as expected in Visual Studio 2019 Update 16.10
This commit is contained in:
Matt Fowles Kulukundis 2021-06-03 17:06:29 -04:00 committed by GitHub
commit c05e7ad0a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]]