Skip to content

Commit 11739d3

Browse files
committed
Fix std::atomic primary template should not have difference_type
1 parent 66f3076 commit 11739d3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

libcxx/include/__atomic/atomic.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ struct __atomic_base // false
4040
{
4141
mutable __cxx_atomic_impl<_Tp> __a_;
4242

43+
using value_type = _Tp;
44+
4345
#if _LIBCPP_STD_VER >= 17
4446
static constexpr bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value;
4547
#endif
@@ -145,6 +147,8 @@ template <class _Tp>
145147
struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> {
146148
using __base _LIBCPP_NODEBUG = __atomic_base<_Tp, false>;
147149

150+
using difference_type = __base::value_type;
151+
148152
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __atomic_base() _NOEXCEPT = default;
149153

150154
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {}
@@ -229,8 +233,6 @@ struct __atomic_waitable_traits<__atomic_base<_Tp, _IsIntegral> > {
229233
template <class _Tp>
230234
struct atomic : public __atomic_base<_Tp> {
231235
using __base _LIBCPP_NODEBUG = __atomic_base<_Tp>;
232-
using value_type = _Tp;
233-
using difference_type = value_type;
234236

235237
#if _LIBCPP_STD_VER >= 20
236238
_LIBCPP_HIDE_FROM_ABI atomic() = default;
@@ -258,8 +260,8 @@ struct atomic : public __atomic_base<_Tp> {
258260
template <class _Tp>
259261
struct atomic<_Tp*> : public __atomic_base<_Tp*> {
260262
using __base _LIBCPP_NODEBUG = __atomic_base<_Tp*>;
261-
using value_type = _Tp*;
262-
using difference_type = ptrdiff_t;
263+
264+
using difference_type = ptrdiff_t;
263265

264266
_LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default;
265267

0 commit comments

Comments
 (0)