From e57d8fcd1d70c4be85f8f07722d1c1d61fe51d2a Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 19 May 2016 23:22:52 -0700 Subject: [PATCH] libcxx: use constexpr when using glibc POSIX does not permit using PTHREAD_COND_INITIALIZER except for static initialization, and certainly does not permit using it as a value also POSIX does not specify the type of the object (it's opaque) so if there are any types for which their code would be invalid C++, then their code is invalid Signed-off-by: Khem Raj --- include/__mutex_base | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/__mutex_base b/include/__mutex_base index 3b2453f1b..08f35434f 100644 --- a/include/__mutex_base +++ b/include/__mutex_base @@ -48,7 +48,10 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mut public: _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_CXX03_LANG - constexpr mutex() = default; +#ifdef __GLIBC__ + constexpr +#endif + mutex() = default; #else mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;} #endif @@ -296,7 +299,10 @@ class _LIBCPP_TYPE_VIS condition_variable public: _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_CXX03_LANG - constexpr condition_variable() _NOEXCEPT = default; +#ifdef __GLIBC__ + constexpr +#endif + condition_variable() _NOEXCEPT = default; #else condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;} #endif -- 2.13.1