Fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100889
libstdc++-v3/ChangeLog: * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait): Change parameter type from _Tp to _Tp*. * testsuite/29_atomics/atomic_ref/deduction.cc: Add reproducer case from PR. --- libstdc++-v3/include/bits/atomic_base.h | 2 +- libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h index 029b8ad65a9..20cf1343c58 100644 --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -1870,7 +1870,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cpp_lib_atomic_wait _GLIBCXX_ALWAYS_INLINE void - wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept + wait(_Tp* __old, memory_order __m = memory_order_seq_cst) const noexcept { __atomic_impl::wait(_M_ptr, __old, __m); } // TODO add const volatile overload diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc index 86395b0c2b0..ed46b430f7c 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc @@ -34,6 +34,7 @@ test01() int* p = &i; std::atomic_ref a2(p); static_assert(std::is_same_v<decltype(a2), std::atomic_ref<int*>>); + a2.store(nullptr); struct X { } x; std::atomic_ref a3(x); -- 2.26.2