@@ -687,12 +687,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__pointer_type _M_p _GLIBCXX20_INIT(nullptr);
- // Factored out to facilitate explicit specialization.
- constexpr ptrdiff_t
- _M_type_size(ptrdiff_t __d) const { return __d * sizeof(_PTp); }
-
- constexpr ptrdiff_t
- _M_type_size(ptrdiff_t __d) const volatile { return __d * sizeof(_PTp); }
+ static constexpr ptrdiff_t
+ _S_type_size(ptrdiff_t __d)
+ { return __d * sizeof(_PTp); }
public:
__atomic_base() noexcept = default;
@@ -742,42 +739,42 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__pointer_type
operator++() noexcept
- { return __atomic_add_fetch(&_M_p, _M_type_size(1),
+ { return __atomic_add_fetch(&_M_p, _S_type_size(1),
int(memory_order_seq_cst)); }
__pointer_type
operator++() volatile noexcept
- { return __atomic_add_fetch(&_M_p, _M_type_size(1),
+ { return __atomic_add_fetch(&_M_p, _S_type_size(1),
int(memory_order_seq_cst)); }
__pointer_type
operator--() noexcept
- { return __atomic_sub_fetch(&_M_p, _M_type_size(1),
+ { return __atomic_sub_fetch(&_M_p, _S_type_size(1),
int(memory_order_seq_cst)); }
__pointer_type
operator--() volatile noexcept
- { return __atomic_sub_fetch(&_M_p, _M_type_size(1),
+ { return __atomic_sub_fetch(&_M_p, _S_type_size(1),
int(memory_order_seq_cst)); }
__pointer_type
operator+=(ptrdiff_t __d) noexcept
- { return __atomic_add_fetch(&_M_p, _M_type_size(__d),
+ { return __atomic_add_fetch(&_M_p, _S_type_size(__d),
int(memory_order_seq_cst)); }
__pointer_type
operator+=(ptrdiff_t __d) volatile noexcept
- { return __atomic_add_fetch(&_M_p, _M_type_size(__d),
+ { return __atomic_add_fetch(&_M_p, _S_type_size(__d),
int(memory_order_seq_cst)); }
__pointer_type
operator-=(ptrdiff_t __d) noexcept
- { return __atomic_sub_fetch(&_M_p, _M_type_size(__d),
+ { return __atomic_sub_fetch(&_M_p, _S_type_size(__d),
int(memory_order_seq_cst)); }
__pointer_type
operator-=(ptrdiff_t __d) volatile noexcept
- { return __atomic_sub_fetch(&_M_p, _M_type_size(__d),
+ { return __atomic_sub_fetch(&_M_p, _S_type_size(__d),
int(memory_order_seq_cst)); }
bool
@@ -932,22 +929,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_ALWAYS_INLINE __pointer_type
fetch_add(ptrdiff_t __d,
memory_order __m = memory_order_seq_cst) noexcept
- { return __atomic_fetch_add(&_M_p, _M_type_size(__d), int(__m)); }
+ { return __atomic_fetch_add(&_M_p, _S_type_size(__d), int(__m)); }
_GLIBCXX_ALWAYS_INLINE __pointer_type
fetch_add(ptrdiff_t __d,
memory_order __m = memory_order_seq_cst) volatile noexcept
- { return __atomic_fetch_add(&_M_p, _M_type_size(__d), int(__m)); }
+ { return __atomic_fetch_add(&_M_p, _S_type_size(__d), int(__m)); }
_GLIBCXX_ALWAYS_INLINE __pointer_type
fetch_sub(ptrdiff_t __d,
memory_order __m = memory_order_seq_cst) noexcept
- { return __atomic_fetch_sub(&_M_p, _M_type_size(__d), int(__m)); }
+ { return __atomic_fetch_sub(&_M_p, _S_type_size(__d), int(__m)); }
_GLIBCXX_ALWAYS_INLINE __pointer_type
fetch_sub(ptrdiff_t __d,
memory_order __m = memory_order_seq_cst) volatile noexcept
- { return __atomic_fetch_sub(&_M_p, _M_type_size(__d), int(__m)); }
+ { return __atomic_fetch_sub(&_M_p, _S_type_size(__d), int(__m)); }
};
namespace __atomic_impl
@@ -453,7 +453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator++(int) noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b++;
}
@@ -462,7 +462,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator++(int) volatile noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b++;
}
@@ -471,7 +471,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator--(int) noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b--;
}
@@ -480,7 +480,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator--(int) volatile noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b--;
}
@@ -489,7 +489,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator++() noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return ++_M_b;
}
@@ -498,7 +498,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator++() volatile noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return ++_M_b;
}
@@ -507,7 +507,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator--() noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return --_M_b;
}
@@ -516,7 +516,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator--() volatile noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return --_M_b;
}
@@ -525,7 +525,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator+=(ptrdiff_t __d) noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b.operator+=(__d);
}
@@ -534,7 +534,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator+=(ptrdiff_t __d) volatile noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b.operator+=(__d);
}
@@ -543,7 +543,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator-=(ptrdiff_t __d) noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b.operator-=(__d);
}
@@ -552,7 +552,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator-=(ptrdiff_t __d) volatile noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b.operator-=(__d);
}
@@ -673,7 +673,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
memory_order __m = memory_order_seq_cst) noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b.fetch_add(__d, __m);
}
@@ -683,7 +683,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
memory_order __m = memory_order_seq_cst) volatile noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b.fetch_add(__d, __m);
}
@@ -693,7 +693,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
memory_order __m = memory_order_seq_cst) noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b.fetch_sub(__d, __m);
}
@@ -703,7 +703,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
memory_order __m = memory_order_seq_cst) volatile noexcept
{
#if __cplusplus >= 201703L
- static_assert( is_object<_Tp>::value, "pointer to object type" );
+ static_assert( is_object_v<_Tp>, "pointer to object type" );
#endif
return _M_b.fetch_sub(__d, __m);
}
@@ -68,3 +68,4 @@ int main(void)
return 0;
}
+// { dg-warning "invalid application of 'sizeof' to a void type" "" { target *-*-* } 0 }