public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97934] New: Defaulting <=> breaks other equality operators
@ 2020-11-21 22:09 barry.revzin at gmail dot com
  2020-11-21 22:20 ` [Bug c++/97934] Adding an operator== breaks implicit operator== generation from defaulted <=> mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: barry.revzin at gmail dot com @ 2020-11-21 22:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97934
           Summary: Defaulting <=> breaks other equality operators
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Reduced example:

#include <compare>

struct X
{
    auto operator<=>(X const&) const = default;
    auto operator==(int i) const;
};

bool f(X x) {
    return x == x;
}

gcc trunk rejects this saying no matching candidate. The presence of the
unrelated operator== seems to prevent the generation of X::operator==(X const&)
const from the defaulted <=>.

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

end of thread, other threads:[~2021-09-23  7:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-21 22:09 [Bug c++/97934] New: Defaulting <=> breaks other equality operators barry.revzin at gmail dot com
2020-11-21 22:20 ` [Bug c++/97934] Adding an operator== breaks implicit operator== generation from defaulted <=> mpolacek at gcc dot gnu.org
2020-11-22  1:59 ` ensadc at mailnesia dot com
2021-09-23  7:13 ` fchelnokov at gmail dot com

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