From c2e99a1ee4df28261c2e3229b77b5d881b5db5db Mon Sep 17 00:00:00 2001 From: Ivan Shynkarenka Date: Thu, 26 Jan 2023 20:10:59 -0800 Subject: [PATCH] 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 (#11674) Closes #11674 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/11674 from chronoxor:main ed65deafa7415c2f42cc94189c37c07115b86680 PiperOrigin-RevId: 505009868 --- src/google/protobuf/arena.cc | 2 +- src/google/protobuf/thread_safe_arena.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc index b83793e300..6ac4bab6c6 100644 --- a/src/google/protobuf/arena.cc +++ b/src/google/protobuf/arena.cc @@ -453,7 +453,7 @@ ThreadSafeArena::ThreadCache& ThreadSafeArena::thread_cache() { return thread_cache; } #else -ABSL_CONST_INIT PROTOBUF_THREAD_LOCAL +PROTOBUF_CONSTINIT PROTOBUF_THREAD_LOCAL ThreadSafeArena::ThreadCache ThreadSafeArena::thread_cache_; #endif diff --git a/src/google/protobuf/thread_safe_arena.h b/src/google/protobuf/thread_safe_arena.h index 1da9d091e6..fa2be1b1cf 100644 --- a/src/google/protobuf/thread_safe_arena.h +++ b/src/google/protobuf/thread_safe_arena.h @@ -260,7 +260,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { // wrap them in static functions. static ThreadCache& thread_cache(); #else - ABSL_CONST_INIT static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_; + PROTOBUF_CONSTINIT static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_; static ThreadCache& thread_cache() { return thread_cache_; } #endif