Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / class / class.compare / class.rel / p1.cpp
blobf61dd4a927d58cff380ea9ed72bd4bffabf96164
1 // RUN: %clang_cc1 -std=c++2a -verify %s
3 struct Good {
4 int operator<=>(const Good&) const;
6 bool operator<(const Good&) const = default;
7 bool operator>(const Good&) const = default;
8 friend bool operator<=(const Good&, const Good&) = default;
9 friend bool operator>=(const Good&, const Good&) = default;
12 enum Bool : bool {};
13 struct Bad {
14 bool &operator<(const Bad&) const = default; // expected-error {{return type for defaulted relational comparison operator must be 'bool', not 'bool &'}}
15 const bool operator>(const Bad&) const = default; // expected-error {{return type for defaulted relational comparison operator must be 'bool', not 'const bool'}}
16 friend Bool operator<=(const Bad&, const Bad&) = default; // expected-error {{return type for defaulted relational comparison operator must be 'bool', not 'Bool'}}
17 friend int operator>=(const Bad&, const Bad&) = default; // expected-error {{return type for defaulted relational comparison operator must be 'bool', not 'int'}}
20 template<typename T> struct Ugly {
21 T operator<(const Ugly&) const = default; // expected-error {{return type}}
22 T operator>(const Ugly&) const = default; // expected-error {{return type}}
23 friend T operator<=(const Ugly&, const Ugly&) = default; // expected-error {{return type}}
24 friend T operator>=(const Ugly&, const Ugly&) = default; // expected-error {{return type}}
26 template struct Ugly<bool>;
27 template struct Ugly<int>; // expected-note {{in instantiation of}}