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