Skip to content

Commit

Permalink
Fixed Visual Studio 2022: protobuf\src\google\protobuf\arena.cc(457,5…
Browse files Browse the repository at this point in the history
…1): error C2127: 'thread_cache_': illegal initialization of 'constinit' entity with a non-constant expression #11672 (#11674)

Closes #11674

COPYBARA_INTEGRATE_REVIEW=#11674 from chronoxor:main ed65dea
PiperOrigin-RevId: 505009868
  • Loading branch information
chronoxor authored and Copybara-Service committed Jan 27, 2023
1 parent 48ff4f6 commit c2e99a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/google/protobuf/arena.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/thread_safe_arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c2e99a1

Please sign in to comment.