1 // { dg-do compile { target c++2a } } 2 3 #include <compare> 4 5 template <class T> 6 struct D 7 { 8 T i; 9 auto operator<=>(D) const = default; // { dg-error "defaulted member" } 10 bool operator==(D) const = default; // { dg-error "defaulted member" } 11 bool operator!=(D) const = default; // { dg-error "defaulted member" } 12 bool operator<(D) const = default; // { dg-error "defaulted member" } 13 bool operator<=(D) const = default; // { dg-error "defaulted member" } 14 bool operator>(D) const = default; // { dg-error "defaulted member" } 15 bool operator>=(D) const = default; // { dg-error "defaulted member" } 16 }; 17 18 template <class T> 19 struct E 20 { 21 T i; 22 friend auto operator<=>(const E&, E) = default; // { dg-error "not both" } 23 friend bool operator==(const E&, E) = default; // { dg-error "not both" } 24 friend bool operator!=(const E&, E) = default; // { dg-error "not both" } 25 friend bool operator<(E, const E&) = default; // { dg-error "not both" } 26 friend bool operator<=(E, const E&) = default; // { dg-error "not both" } 27 friend bool operator>(E, const E&) = default; // { dg-error "not both" } 28 friend bool operator>=(E, const E&) = default; // { dg-error "not both" } 29 }; 30