[Bug c++/97934] New: Defaulting <=> breaks other equality operators
barry.revzin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Nov 21 22:09:27 GMT 2020
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 <=>.
More information about the Gcc-bugs
mailing list