https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95567
Bug ID: 95567 Summary: Defaulted virtual <=> has the wrong behavior 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 from Twitter user @feder_and_ink: #include <compare> struct B { B(int i) : i(i) {} VIRTUAL std::strong_ordering operator<=>(B const& other) const = default; int i; }; struct D : B { D(int i, int j) : B(i), j(j) {} int j; }; bool check() { return B(2) == D(2, 3); } With -DVIRTUAL=, check() returns true. With -DVIRTUAL=virtual, check() erroneously returns false. On compiler explorer: https://godbolt.org/z/hc3U5f