public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR libstdc++/100889: Fix wrong param type in atomic_ref<_Tp*>::wait
@ 2021-06-04 23:04 Thomas Rodgers
  2021-06-04 23:18 ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Rodgers @ 2021-06-04 23:04 UTC (permalink / raw)
  To: gcc-patches, libstdc++; +Cc: trodgers, Thomas Rodgers

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-09 15:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 23:04 [PATCH] PR libstdc++/100889: Fix wrong param type in atomic_ref<_Tp*>::wait Thomas Rodgers
2021-06-04 23:18 ` Jonathan Wakely
2021-06-05  0:44   ` [PATCH] [libstdc++] Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] Thomas Rodgers
2021-06-07 22:02   ` [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] [PR100889] Thomas Rodgers
2021-06-08  0:28     ` [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889] Thomas Rodgers
2021-06-08 15:44       ` Jonathan Wakely
2021-06-08 23:03         ` Thomas Rodgers
2021-06-09 14:30           ` Christophe Lyon
2021-06-09 14:52             ` Thomas Rodgers
2021-06-09 15:11               ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).