[gcn] install.texi: Update for new ISA targets and their requirements
[gcc.git] / gcc / testsuite / g++.dg / cpp23 / explicit-obj-ops-non-mem.h
blobb897a4bac71f6da09e3f1ca869287f7601f97430
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; }
47 struct Value {
48 MAKE_STRUCT_OPS (Value)
51 struct LRef {
52 MAKE_STRUCT_OPS (LRef&)
55 struct RRef {
56 MAKE_STRUCT_OPS (RRef&&)
59 struct ConstLRef {
60 MAKE_STRUCT_OPS (ConstLRef const&)
63 struct ConstRRef {
64 MAKE_STRUCT_OPS (ConstRRef const&&)
67 #undef MAKE_STRUCT_OPS
69 struct Deduced {
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) \
118 (OPERAND) += 0; \
119 (OPERAND) -= 0; \
120 (OPERAND) *= 0; \
121 (OPERAND) /= 0; \
122 (OPERAND) %= 0; \
123 (OPERAND) &= 0; \
124 (OPERAND) |= 0; \
125 (OPERAND) ^= 0; \
126 (OPERAND) <<= 0; \
127 (OPERAND) >>= 0; \
129 ++(OPERAND); \
130 --(OPERAND); \
131 (OPERAND)++; \
132 (OPERAND)--; \
134 +(OPERAND); \
135 -(OPERAND); \
136 (OPERAND) + 0; \
137 (OPERAND) - 0; \
138 (OPERAND) * 0; \
139 (OPERAND) / 0; \
140 (OPERAND) % 0; \
141 (OPERAND) & 0; \
142 (OPERAND) | 0; \
143 (OPERAND) ^ 0; \
144 (OPERAND) << 0; \
145 (OPERAND) >> 0; \
147 !(OPERAND); \
148 (OPERAND) && 0; \
149 (OPERAND) || 0; \
151 (OPERAND) == 0; \
152 (OPERAND) != 0; \
153 (OPERAND) < 0; \
154 (OPERAND) > 0; \
155 (OPERAND) <= 0; \
156 (OPERAND) >= 0; \
157 (OPERAND) <=> 0; \
159 *(OPERAND); \
160 (OPERAND) ->* 0; \
161 &(OPERAND); \
162 (OPERAND), 0;
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)));