1d052a578SRichard Smith // RUN: %clang_cc1 -std=c++2a -verify %s 2d052a578SRichard Smith 3d052a578SRichard Smith struct Good { 4*5253d913SRichard Smith int operator<=>(const Good&) const; 5*5253d913SRichard Smith 6d052a578SRichard Smith bool operator<(const Good&) const = default; 7d052a578SRichard Smith bool operator>(const Good&) const = default; 8d052a578SRichard Smith friend bool operator<=(const Good&, const Good&) = default; 9d052a578SRichard Smith friend bool operator>=(const Good&, const Good&) = default; 10d052a578SRichard Smith }; 11d052a578SRichard Smith 12d052a578SRichard Smith enum Bool : bool {}; 13d052a578SRichard Smith struct Bad { 14d052a578SRichard Smith bool &operator<(const Bad&) const = default; // expected-error {{return type for defaulted relational comparison operator must be 'bool', not 'bool &'}} 15d052a578SRichard Smith const bool operator>(const Bad&) const = default; // expected-error {{return type for defaulted relational comparison operator must be 'bool', not 'const bool'}} 16d052a578SRichard Smith friend Bool operator<=(const Bad&, const Bad&) = default; // expected-error {{return type for defaulted relational comparison operator must be 'bool', not 'Bool'}} 17d052a578SRichard Smith friend int operator>=(const Bad&, const Bad&) = default; // expected-error {{return type for defaulted relational comparison operator must be 'bool', not 'int'}} 18d052a578SRichard Smith }; 19d052a578SRichard Smith 20d052a578SRichard Smith template<typename T> struct Ugly { 21d052a578SRichard Smith T operator<(const Ugly&) const = default; // expected-error {{return type}} 22d052a578SRichard Smith T operator>(const Ugly&) const = default; // expected-error {{return type}} 23d052a578SRichard Smith friend T operator<=(const Ugly&, const Ugly&) = default; // expected-error {{return type}} 24d052a578SRichard Smith friend T operator>=(const Ugly&, const Ugly&) = default; // expected-error {{return type}} 25d052a578SRichard Smith }; 26d052a578SRichard Smith template struct Ugly<bool>; 27d052a578SRichard Smith template struct Ugly<int>; // expected-note {{in instantiation of}} 28