public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/102994] New: std::atomic<ptr>::wait is not marked const
@ 2021-10-29  2:37 gcc_bugzilla at axeitado dot com
  2021-10-30 10:42 ` [Bug libstdc++/102994] " redi at gcc dot gnu.org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: gcc_bugzilla at axeitado dot com @ 2021-10-29  2:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102994
           Summary: std::atomic<ptr>::wait is not marked const
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc_bugzilla at axeitado dot com
  Target Milestone: ---

This code fails to compile because the `wait' member function is not marked
`const' in the specialization of std::atomic for pointers:

#include <atomic>

void foo(const std::atomic<char*> &a, char *p) {
    a.wait(p);
}


g++ --std=c++20

<source>: In function 'void foo(const std::atomic<char*>&, char*)':
<source>:4:11: error: passing 'const std::atomic<char*>' as 'this' argument
discards qualifiers [-fpermissive]
    4 |     a.wait(p);
      |     ~~~~~~^~~
In file included from <source>:1:
/opt/compiler-explorer/gcc-trunk-20211028/include/c++/12.0.0/atomic:651:5:
note:   in call to 'void
std::atomic<_Tp*>::wait(std::atomic<_Tp*>::__pointer_type, std::memory_order)
[with _Tp = char; std::atomic<_Tp*>::__pointer_type = char*]'
  651 |     wait(__pointer_type __old, memory_order __m = memory_order_seq_cst)
noexcept
      |     ^~~~
Compiler returned: 1

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

end of thread, other threads:[~2022-05-10 14:57 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29  2:37 [Bug libstdc++/102994] New: std::atomic<ptr>::wait is not marked const gcc_bugzilla at axeitado dot com
2021-10-30 10:42 ` [Bug libstdc++/102994] " redi at gcc dot gnu.org
2021-12-10  1:57 ` cvs-commit at gcc dot gnu.org
2021-12-10  2:14 ` cvs-commit at gcc dot gnu.org
2021-12-10 10:52 ` redi at gcc dot gnu.org
2022-02-03 20:31 ` gcc_bugzilla at axeitado dot com
2022-02-03 21:01 ` redi at gcc dot gnu.org
2022-02-03 21:34 ` gcc_bugzilla at axeitado dot com
2022-02-04  0:03 ` rodgertq at gcc dot gnu.org
2022-02-04  0:33 ` redi at gcc dot gnu.org
2022-02-04  0:39 ` redi at gcc dot gnu.org
2022-02-04  0:44 ` redi at gcc dot gnu.org
2022-02-04  0:55 ` rodgertq at gcc dot gnu.org
2022-02-04  1:37 ` gcc_bugzilla at axeitado dot com
2022-02-04 10:55 ` redi at gcc dot gnu.org
2022-02-11 17:41 ` rodgertq at gcc dot gnu.org
2022-04-07 15:42 ` redi at gcc dot gnu.org
2022-04-21  7:50 ` rguenth at gcc dot gnu.org
2022-04-22 22:53 ` cvs-commit at gcc dot gnu.org
2022-04-22 22:54 ` cvs-commit at gcc dot gnu.org
2022-05-10 14:57 ` 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).