public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "janschultke at googlemail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/113386] New: std::pair comparison operators should be transparent, but are not in libstdc++ Date: Sun, 14 Jan 2024 09:01:47 +0000 [thread overview] Message-ID: <bug-113386-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113386 Bug ID: 113386 Summary: std::pair comparison operators should be transparent, but are not in libstdc++ Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: janschultke at googlemail dot com Target Milestone: --- ## Code to reproduce #include <utility> bool equals(const std::pair<int, int>& a, const std::pair<const int, const int>& b) { return a == b; } ## Explanation Clang with -stdlib=libc++ compiles this, as does MSVC. Bug #90203 was incorrectly closed. std::pair comparison operators should be transparent, see https://eel.is/c++draft/pairs.spec The standard requires the signature: > template<class T1, class T2, class U1, class U2> > constexpr bool operator==(const pair<T1, T2>& x, const pair<U1, U2>& y); libstdc++ incorrectly implements this with only two template parameters: > template<typename _T1, typename _T2> > inline _GLIBCXX_CONSTEXPR bool > operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) > { return __x.first == __y.first && __x.second == __y.second; }
next reply other threads:[~2024-01-14 9:01 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-14 9:01 janschultke at googlemail dot com [this message] 2024-01-14 9:03 ` [Bug libstdc++/113386] " janschultke at googlemail dot com 2024-01-14 9:19 ` pinskia at gcc dot gnu.org 2024-01-14 9:19 ` pinskia at gcc dot gnu.org 2024-01-14 9:24 ` [Bug libstdc++/113386] [C++23] " janschultke at googlemail dot com 2024-01-14 9:26 ` janschultke at googlemail dot com 2024-01-14 9:28 ` pinskia at gcc dot gnu.org 2024-01-14 9:55 ` janschultke at googlemail dot com 2024-01-14 12:55 ` redi at gcc dot gnu.org 2024-01-15 14:46 ` redi at gcc dot gnu.org 2024-01-29 20:29 ` redi at gcc dot gnu.org 2024-04-15 18:29 ` cvs-commit at gcc dot gnu.org 2024-04-15 18:33 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-113386-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).