Skip to content

Commit a3e63b1

Browse files
committed
Make sure that std:atomic mandates are checked first
1 parent 06a40cf commit a3e63b1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libcxx/include/__atomic/support.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,14 @@
111111

112112
_LIBCPP_BEGIN_NAMESPACE_STD
113113

114-
template <typename _Tp, typename _Base = __cxx_atomic_base_impl<_Tp> >
115-
struct __cxx_atomic_impl : public _Base {
114+
template <typename _Tp>
115+
struct __check_atomic_mandates {
116+
using type = _Tp;
116117
static_assert(is_trivially_copyable<_Tp>::value, "std::atomic<T> requires that 'T' be a trivially copyable type");
118+
};
117119

120+
template <typename _Tp, typename _Base = __cxx_atomic_base_impl<typename __check_atomic_mandates<_Tp>::type> >
121+
struct __cxx_atomic_impl : public _Base {
118122
_LIBCPP_HIDE_FROM_ABI __cxx_atomic_impl() _NOEXCEPT = default;
119123
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp __value) _NOEXCEPT : _Base(__value) {}
120124
};

0 commit comments

Comments
 (0)