Fixed Visual Studio 2022: protobuf\src\google\protobuf\arena.cc(457,51): error C2127: 'thread_cache_': illegal initialization of 'constinit' entity with a non-constant expression #11672

pull/11674/head
Ivan Shynkarenka 2 years ago
parent f4d26f955d
commit ed65deafa7
  1. 2
      src/google/protobuf/arena.cc
  2. 2
      src/google/protobuf/thread_safe_arena.h

@ -453,7 +453,7 @@ ThreadSafeArena::ThreadCache& ThreadSafeArena::thread_cache() {
return thread_cache;
}
#else
PROTOBUF_THREAD_LOCAL
PROTOBUF_CONSTINIT PROTOBUF_THREAD_LOCAL
ThreadSafeArena::ThreadCache ThreadSafeArena::thread_cache_;
#endif

@ -260,7 +260,7 @@ class PROTOBUF_EXPORT ThreadSafeArena {
// wrap them in static functions.
static ThreadCache& thread_cache();
#else
static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_;
PROTOBUF_CONSTINIT static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_;
static ThreadCache& thread_cache() { return thread_cache_; }
#endif

Loading…
Cancel
Save