Skip to content

Commit 26013d0

Browse files
committed
Fix GCC error about 2nd argument to the '__atomic' builtins being a pointer to a volatile type
1 parent 28a0107 commit 26013d0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libcxx/include/__atomic/atomic_ref.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ struct __get_aligner_instance {
6464

6565
template <class _Tp>
6666
struct __atomic_ref_base {
67+
using value_type = __remove_cv_t<_Tp>;
68+
6769
private:
68-
_LIBCPP_HIDE_FROM_ABI static _Tp* __clear_padding(_Tp& __val) noexcept {
69-
_Tp* __ptr = std::addressof(__val);
70+
_LIBCPP_HIDE_FROM_ABI static value_type* __clear_padding(value_type& __val) noexcept {
71+
value_type* __ptr = std::addressof(__val);
7072
# if __has_builtin(__builtin_clear_padding)
7173
__builtin_clear_padding(__ptr);
7274
# endif
@@ -115,8 +117,6 @@ struct __atomic_ref_base {
115117
static constexpr size_t __min_alignment = (sizeof(_Tp) & (sizeof(_Tp) - 1)) || (sizeof(_Tp) > 16) ? 0 : sizeof(_Tp);
116118

117119
public:
118-
using value_type = __remove_cv_t<_Tp>;
119-
120120
static constexpr size_t required_alignment = alignof(_Tp) > __min_alignment ? alignof(_Tp) : __min_alignment;
121121

122122
// The __atomic_always_lock_free builtin takes into account the alignment of the pointer if provided,

0 commit comments

Comments
 (0)