From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 271A63858C39; Fri, 29 Oct 2021 02:37:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 271A63858C39 From: "gcc_bugzilla at axeitado dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/102994] New: std::atomic::wait is not marked const Date: Fri, 29 Oct 2021 02:37:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gcc_bugzilla at axeitado dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2021 02:37:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102994 Bug ID: 102994 Summary: std::atomic::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 void foo(const std::atomic &a, char *p) { a.wait(p); } g++ --std=3Dc++20 : In function 'void foo(const std::atomic&, char*)': :4:11: error: passing 'const std::atomic' as 'this' argument discards qualifiers [-fpermissive] 4 | a.wait(p); | ~~~~~~^~~ In file included from :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_orde= r) [with _Tp =3D char; std::atomic<_Tp*>::__pointer_type =3D char*]' 651 | wait(__pointer_type __old, memory_order __m =3D memory_order_se= q_cst) noexcept | ^~~~ Compiler returned: 1=