public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100889] New: Wrong param type for std::atomic_ref<_Tp*>::wait
@ 2021-06-03  5:59 richardpku at gmail dot com
  2021-06-03  6:02 ` [Bug libstdc++/100889] " richardpku at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: richardpku at gmail dot com @ 2021-06-03  5:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100889

            Bug ID: 100889
           Summary: Wrong param type for std::atomic_ref<_Tp*>::wait
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richardpku at gmail dot com
  Target Milestone: ---

/tmp % cat a.cpp
#include <atomic>
void* p;
void foo() { std::atomic_ref(p).store(nullptr); }

/tmp % g++-11.1.0 -c -std=gnu++20 a.cpp
In file included from
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/atomic:41,
                 from a.cpp:1:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/atomic_base.h: In
instantiation of 'struct std::__atomic_ref<void*, false, false>':
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/atomic:1618:12:  
required from 'struct std::atomic_ref<void*>'
a.cpp:3:31:   required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/atomic_base.h:1873:7:
error: invalid parameter type 'void'
 1873 |       wait(_Tp __old, memory_order __m = memory_order_seq_cst) const
noexcept
      |       ^~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/g++-v11/bits/atomic_base.h:1873:7:
error: in declaration 'void std::__atomic_ref<_Tp*, false, false>::wait(_Tp,
std::memory_order) const'


Apparently, the first param of std::atomic<_Tp*>::wait should be _Tp* instead
of _Tp.

It appears this bug has existed since GCC 11, when __cpp_lib_atomic_wait was
implemented.

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

end of thread, other threads:[~2021-06-08 23:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03  5:59 [Bug libstdc++/100889] New: Wrong param type for std::atomic_ref<_Tp*>::wait richardpku at gmail dot com
2021-06-03  6:02 ` [Bug libstdc++/100889] " richardpku at gmail dot com
2021-06-03 10:20 ` redi at gcc dot gnu.org
2021-06-04 15:44 ` rodgertq at gcc dot gnu.org
2021-06-08 23:01 ` cvs-commit at gcc dot gnu.org
2021-06-08 23:02 ` cvs-commit at gcc dot gnu.org
2021-06-08 23:11 ` rodgertq at gcc dot gnu.org

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).