public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/113386] New: std::pair comparison operators should be transparent, but are not in libstdc++
@ 2024-01-14  9:01 janschultke at googlemail dot com
  2024-01-14  9:03 ` [Bug libstdc++/113386] " janschultke at googlemail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: janschultke at googlemail dot com @ 2024-01-14  9:01 UTC (permalink / raw)
  To: gcc-bugs

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; }

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

end of thread, other threads:[~2024-04-15 18:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-14  9:01 [Bug libstdc++/113386] New: std::pair comparison operators should be transparent, but are not in libstdc++ janschultke at googlemail dot com
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

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