1 // tests for ops that must be member functions are seperate
3 // the name of the class refers to the type of it's member functions xobj parameter
5 #define MAKE_STRUCT_OPS(TYPE) \
6 TYPE operator+=(this TYPE self, int) { return self; } \
7 TYPE operator-=(this TYPE self, int) { return self; } \
8 TYPE operator*=(this TYPE self, int) { return self; } \
9 TYPE operator/=(this TYPE self, int) { return self; } \
10 TYPE operator%=(this TYPE self, int) { return self; } \
11 TYPE operator&=(this TYPE self, int) { return self; } \
12 TYPE operator|=(this TYPE self, int) { return self; } \
13 TYPE operator^=(this TYPE self, int) { return self; } \
14 TYPE operator<<=(this TYPE self, int) { return self; } \
15 TYPE operator>>=(this TYPE self, int) { return self; } \
16 TYPE operator++(this TYPE self) { return self; } \
17 TYPE operator--(this TYPE self) { return self; } \
18 TYPE operator++(this TYPE self, int) { return self; } \
19 TYPE operator--(this TYPE self, int) { return self; } \
20 TYPE operator+(this TYPE self) { return self; } \
21 TYPE operator-(this TYPE self) { return self; } \
22 TYPE operator+(this TYPE self, int) { return self; } \
23 TYPE operator-(this TYPE self, int) { return self; } \
24 TYPE operator*(this TYPE self, int) { return self; } \
25 TYPE operator/(this TYPE self, int) { return self; } \
26 TYPE operator%(this TYPE self, int) { return self; } \
27 TYPE operator&(this TYPE self, int) { return self; } \
28 TYPE operator|(this TYPE self, int) { return self; } \
29 TYPE operator^(this TYPE self, int) { return self; } \
30 TYPE operator<<(this TYPE self, int) { return self; } \
31 TYPE operator>>(this TYPE self, int) { return self; } \
32 TYPE operator!(this TYPE self) { return self; } \
33 TYPE operator&&(this TYPE self, int const&) { return self; } \
34 TYPE operator||(this TYPE self, int const&) { return self; } \
35 TYPE operator==(this TYPE self, int) { return self; } \
36 TYPE operator!=(this TYPE self, int) { return self; } \
37 TYPE operator<(this TYPE self, int) { return self; } \
38 TYPE operator>(this TYPE self, int) { return self; } \
39 TYPE operator<=(this TYPE self, int) { return self; } \
40 TYPE operator>=(this TYPE self, int) { return self; } \
41 TYPE operator<=>(this TYPE self, int) { return self; } \
42 TYPE operator*(this TYPE self) { return self; } \
43 TYPE operator->*(this TYPE self, int) { return self; } \
44 TYPE operator&(this TYPE self) { return self; } \
45 TYPE operator,(this TYPE self, int) { return self; }
48 MAKE_STRUCT_OPS (Value
)
52 MAKE_STRUCT_OPS (LRef
&)
56 MAKE_STRUCT_OPS (RRef
&&)
60 MAKE_STRUCT_OPS (ConstLRef
const&)
64 MAKE_STRUCT_OPS (ConstRRef
const&&)
67 #undef MAKE_STRUCT_OPS
70 template<typename Self
> Self
&& operator+=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
71 template<typename Self
> Self
&& operator-=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
72 template<typename Self
> Self
&& operator*=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
73 template<typename Self
> Self
&& operator/=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
74 template<typename Self
> Self
&& operator%=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
75 template<typename Self
> Self
&& operator&=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
76 template<typename Self
> Self
&& operator|=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
77 template<typename Self
> Self
&& operator^=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
78 template<typename Self
> Self
&& operator<<=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
79 template<typename Self
> Self
&& operator>>=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
81 template<typename Self
> Self
&& operator++(this Self
&& self
) { return static_cast<Self
&&>(self
); }
82 template<typename Self
> Self
&& operator--(this Self
&& self
) { return static_cast<Self
&&>(self
); }
83 template<typename Self
> Self
&& operator++(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
84 template<typename Self
> Self
&& operator--(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
86 template<typename Self
> Self
&& operator+(this Self
&& self
) { return static_cast<Self
&&>(self
); }
87 template<typename Self
> Self
&& operator-(this Self
&& self
) { return static_cast<Self
&&>(self
); }
88 template<typename Self
> Self
&& operator+(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
89 template<typename Self
> Self
&& operator-(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
90 template<typename Self
> Self
&& operator*(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
91 template<typename Self
> Self
&& operator/(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
92 template<typename Self
> Self
&& operator%(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
93 template<typename Self
> Self
&& operator&(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
94 template<typename Self
> Self
&& operator|(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
95 template<typename Self
> Self
&& operator^(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
96 template<typename Self
> Self
&& operator<<(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
97 template<typename Self
> Self
&& operator>>(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
99 template<typename Self
> Self
&& operator!(this Self
&& self
) { return static_cast<Self
&&>(self
); }
100 template<typename Self
> Self
&& operator&&(this Self
&& self
, int const&) { return static_cast<Self
&&>(self
); }
101 template<typename Self
> Self
&& operator||(this Self
&& self
, int const&) { return static_cast<Self
&&>(self
); }
103 template<typename Self
> Self
&& operator==(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
104 template<typename Self
> Self
&& operator!=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
105 template<typename Self
> Self
&& operator<(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
106 template<typename Self
> Self
&& operator>(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
107 template<typename Self
> Self
&& operator<=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
108 template<typename Self
> Self
&& operator>=(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
109 template<typename Self
> Self
&& operator<=>(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
111 template<typename Self
> Self
&& operator*(this Self
&& self
) { return static_cast<Self
&&>(self
); }
112 template<typename Self
> Self
&& operator->*(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
113 template<typename Self
> Self
&& operator&(this Self
&& self
) { return static_cast<Self
&&>(self
); }
114 template<typename Self
> Self
&& operator,(this Self
&& self
, int) { return static_cast<Self
&&>(self
); }
117 #define TEST_OPS(OPERAND) \
164 #define VALIDATE_RETURN_TYPES(OPERAND, CORRECT_TYPE) \
165 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) += 0))); \
166 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) -= 0))); \
167 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) *= 0))); \
168 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) /= 0))); \
169 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) %= 0))); \
170 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) &= 0))); \
171 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) |= 0))); \
172 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) ^= 0))); \
173 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) <<= 0))); \
174 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) >>= 0))); \
176 static_assert(__is_same(CORRECT_TYPE, decltype(++(OPERAND)))); \
177 static_assert(__is_same(CORRECT_TYPE, decltype(--(OPERAND)))); \
178 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND)++))); \
179 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND)--))); \
181 static_assert(__is_same(CORRECT_TYPE, decltype(+(OPERAND)))); \
182 static_assert(__is_same(CORRECT_TYPE, decltype(-(OPERAND)))); \
183 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) + 0))); \
184 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) - 0))); \
185 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) * 0))); \
186 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) / 0))); \
187 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) % 0))); \
188 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) & 0))); \
189 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) | 0))); \
190 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) ^ 0))); \
191 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) << 0))); \
192 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) >> 0))); \
194 static_assert(__is_same(CORRECT_TYPE, decltype(!(OPERAND)))); \
195 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) && 0))); \
196 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) || 0))); \
198 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) == 0))); \
199 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) != 0))); \
200 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) < 0))); \
201 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) > 0))); \
202 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) <= 0))); \
203 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) >= 0))); \
204 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) <=> 0))); \
206 static_assert(__is_same(CORRECT_TYPE, decltype(*(OPERAND)))); \
207 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) ->* 0))); \
208 static_assert(__is_same(CORRECT_TYPE, decltype(&(OPERAND)))); \
209 static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND), 0)));