Skip to content

Commit

Permalink
stubs/mutex: Fix compilation by initializing variable in WrappedMutex…
Browse files Browse the repository at this point in the history
… class.

This solves the following error in gcc:
explicitly defaulted function cannot be declared 'constexpr' because the implicit declaration is not 'constexpr'
  • Loading branch information
Biswa96 authored and acozzette committed Jan 13, 2021
1 parent 4a09d77 commit 19fb894
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/google/protobuf/stubs/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ class GOOGLE_PROTOBUF_CAPABILITY("mutex") PROTOBUF_EXPORT WrappedMutex {
void AssertHeld() const {}

private:
#if defined(_MSC_VER)
CallOnceInitializedMutex<std::mutex> mu_;
#elif defined(GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP)
CallOnceInitializedMutex<CriticalSectionLock> mu_;
#if defined(GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP)
CallOnceInitializedMutex<CriticalSectionLock> mu_ {};
#elif defined(_MSC_VER)
CallOnceInitializedMutex<std::mutex> mu_ {};
#else
std::mutex mu_;
std::mutex mu_ {};
#endif
};

Expand Down

0 comments on commit 19fb894

Please sign in to comment.