1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 // Check that __cpp17_*_iterator catch bad iterators
10
11 // UNSUPPORTED: c++03, c++11, c++14, c++17
12
13 #include <__iterator/cpp17_iterator_concepts.h>
14 #include <__iterator/iterator_traits.h>
15 #include <compare>
16 #include <cstddef>
17
18 struct missing_deref {
19 using difference_type = std::ptrdiff_t;
20 using iterator_category = std::input_iterator_tag;
21 using value_type = int;
22 using reference = int&;
23
24 missing_deref& operator++();
25 };
26
27 struct missing_preincrement {
28 using difference_type = std::ptrdiff_t;
29 using iterator_category = std::input_iterator_tag;
30 using value_type = int;
31 using reference = int&;
32
33 int& operator*();
34 };
35
36 template <class Derived>
37 struct valid_iterator {
38 using difference_type = std::ptrdiff_t;
39 using iterator_category = std::input_iterator_tag;
40 using value_type = int;
41 using reference = int&;
42
43 int& operator*() const;
44 Derived& operator++();
45
46 struct Proxy {
47 int operator*();
48 };
49
50 Proxy operator++(int);
51 };
52
53 struct not_move_constructible : valid_iterator<not_move_constructible> {
54 not_move_constructible(const not_move_constructible&) = default;
55 not_move_constructible(not_move_constructible&&) = delete;
56 not_move_constructible& operator=(not_move_constructible&&) = default;
57 not_move_constructible& operator=(const not_move_constructible&) = default;
58 };
59
60 struct not_copy_constructible : valid_iterator<not_copy_constructible> {
61 not_copy_constructible(const not_copy_constructible&) = delete;
62 not_copy_constructible(not_copy_constructible&&) = default;
63 not_copy_constructible& operator=(not_copy_constructible&&) = default;
64 not_copy_constructible& operator=(const not_copy_constructible&) = default;
65 };
66
67 struct not_move_assignable : valid_iterator<not_move_assignable> {
68 not_move_assignable(const not_move_assignable&) = default;
69 not_move_assignable(not_move_assignable&&) = default;
70 not_move_assignable& operator=(not_move_assignable&&) = delete;
71 not_move_assignable& operator=(const not_move_assignable&) = default;
72 };
73
74 struct not_copy_assignable : valid_iterator<not_copy_assignable> {
75 not_copy_assignable(const not_copy_assignable&) = default;
76 not_copy_assignable(not_copy_assignable&&) = default;
77 not_copy_assignable& operator=(not_copy_assignable&&) = default;
78 not_copy_assignable& operator=(const not_copy_assignable&) = delete;
79 };
80
81 struct diff_t_not_signed : valid_iterator<diff_t_not_signed> {
82 using difference_type = unsigned;
83 };
84
check_iterator_requirements()85 void check_iterator_requirements() {
86 static_assert(std::__cpp17_iterator<missing_deref>); // expected-error {{static assertion failed}}
87 // expected-note@*:* {{indirection requires pointer operand}}
88
89 static_assert(std::__cpp17_iterator<missing_preincrement>); // expected-error {{static assertion failed}}
90 // expected-note@*:* {{cannot increment value of type 'missing_preincrement'}}
91
92
93 static_assert(std::__cpp17_iterator<not_move_constructible>); // expected-error {{static assertion failed}}
94 // expected-note@*:* {{because 'not_move_constructible' does not satisfy '__cpp17_move_constructible'}}
95
96 static_assert(std::__cpp17_iterator<not_copy_constructible>); // expected-error {{static assertion failed}}
97 // expected-note@*:* {{because 'not_copy_constructible' does not satisfy '__cpp17_copy_constructible'}}
98
99 static_assert(std::__cpp17_iterator<not_move_assignable>); // expected-error {{static assertion failed}}
100 // expected-note@*:* {{because 'not_move_assignable' does not satisfy '__cpp17_copy_assignable'}}
101
102 static_assert(std::__cpp17_iterator<not_copy_assignable>); // expected-error {{static assertion failed}}
103 // expectted-note@*:* {{because 'not_copy_assignable' does not satisfy '__cpp17_copy_assignable'}}
104
105 static_assert(std::__cpp17_iterator<diff_t_not_signed>); // expected-error {{static assertion failed}}
106 // expectted-note@*:* {{'is_signed_v<__iter_diff_t<diff_t_not_signed> >' evaluated to false}}
107 }
108
109 struct not_equality_comparable : valid_iterator<not_equality_comparable> {};
110 bool operator==(not_equality_comparable, not_equality_comparable) = delete;
111 bool operator!=(not_equality_comparable, not_equality_comparable);
112
113 struct not_unequality_comparable : valid_iterator<not_unequality_comparable> {};
114 bool operator==(not_unequality_comparable, not_unequality_comparable);
115 bool operator!=(not_unequality_comparable, not_unequality_comparable) = delete;
116
check_input_iterator_requirements()117 void check_input_iterator_requirements() {
118 _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(not_equality_comparable); // expected-error {{static assertion failed}}
119 // expected-note@*:* {{'__lhs == __rhs' would be invalid: overload resolution selected deleted operator '=='}}
120
121 _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(not_unequality_comparable); // expected-error {{static assertion failed}}
122 // expected-note@*:* {{'__lhs != __rhs' would be invalid: overload resolution selected deleted operator '!='}}
123 }
124
125 template <class Derived>
126 struct valid_forward_iterator : valid_iterator<Derived> {
127 Derived& operator++();
128 Derived operator++(int);
129
130 friend bool operator==(Derived, Derived);
131 };
132
133 struct not_default_constructible : valid_forward_iterator<not_default_constructible> {
134 not_default_constructible() = delete;
135 };
136
137 struct postincrement_not_ref : valid_iterator<postincrement_not_ref> {};
138 bool operator==(postincrement_not_ref, postincrement_not_ref);
139
check_forward_iterator_requirements()140 void check_forward_iterator_requirements() {
141 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(not_default_constructible); // expected-error {{static assertion failed}}
142 // expected-note@*:* {{because 'not_default_constructible' does not satisfy '__cpp17_default_constructible'}}
143 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(postincrement_not_ref); // expected-error {{static assertion failed}}
144 #ifndef _AIX
145 // expected-note@*:* {{because type constraint 'convertible_to<valid_iterator<postincrement_not_ref>::Proxy, const postincrement_not_ref &>' was not satisfied}}
146 #endif
147 }
148
149 struct missing_predecrement : valid_forward_iterator<missing_predecrement> {
150 missing_deref operator--(int);
151 };
152
153 struct missing_postdecrement : valid_forward_iterator<missing_postdecrement> {
154 missing_postdecrement& operator--();
155 };
156
157 struct not_returning_iter_reference : valid_forward_iterator<not_returning_iter_reference> {
158
159 struct Proxy {
160 operator const not_returning_iter_reference&();
161
162 int operator*();
163 };
164
165 not_returning_iter_reference& operator--();
166 Proxy operator--(int);
167 };
168
check_bidirectional_iterator_requirements()169 void check_bidirectional_iterator_requirements() {
170 _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(missing_predecrement); // expected-error {{static assertion failed}}
171 // expected-note@*:* {{cannot decrement value of type 'missing_predecrement'}}
172 _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(missing_postdecrement); // expected-error {{static assertion failed}}
173 // expected-note@*:* {{cannot decrement value of type 'missing_postdecrement'}}
174 _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(not_returning_iter_reference); // expected-error {{static assertion failed}}
175 // expected-note@*:* {{because type constraint 'same_as<int, __iter_reference<not_returning_iter_reference> >' was not satisfied}}
176 }
177
178 template <class Derived>
179 struct valid_random_access_iterator : valid_forward_iterator<Derived> {
180 using difference_type = typename valid_forward_iterator<Derived>::difference_type;
181
182 Derived& operator--();
183 Derived operator--(int);
184
185 Derived& operator+=(difference_type);
186 Derived& operator-=(difference_type);
187
188 friend Derived operator+(valid_random_access_iterator, difference_type);
189 friend Derived operator+(difference_type, valid_random_access_iterator);
190 friend Derived operator-(valid_random_access_iterator, difference_type);
191 friend Derived operator-(difference_type, valid_random_access_iterator);
192 friend difference_type operator-(valid_random_access_iterator, valid_random_access_iterator);
193
194 int& operator[](difference_type) const;
195
196 friend std::strong_ordering operator<=>(Derived, Derived);
197 };
198
199 struct missing_plus_equals : valid_random_access_iterator<missing_plus_equals> {
200 void operator+=(difference_type) = delete;
201 };
202
203 struct missing_minus_equals : valid_random_access_iterator<missing_minus_equals> {
204 void operator-=(difference_type) = delete;
205 };
206
207 struct missing_plus_iter_diff : valid_random_access_iterator<missing_plus_iter_diff> {
208 void operator+(difference_type) = delete;
209 };
210
211 struct missing_plus_diff_iter : valid_random_access_iterator<missing_plus_diff_iter> {
212 friend missing_plus_diff_iter operator+(difference_type, missing_plus_diff_iter) = delete;
213 };
214
215 struct missing_plus_iter_diff_const_mut : valid_random_access_iterator<missing_plus_iter_diff_const_mut> {
216 friend missing_plus_iter_diff_const_mut operator+(missing_plus_iter_diff_const_mut&, difference_type);
217 friend missing_plus_iter_diff_const_mut operator+(const missing_plus_iter_diff_const_mut&, difference_type) = delete;
218 };
219
220 struct missing_plus_iter_diff_mut_const : valid_random_access_iterator<missing_plus_iter_diff_mut_const> {
221 friend missing_plus_iter_diff_mut_const operator+(missing_plus_iter_diff_mut_const, difference_type);
222 friend missing_plus_iter_diff_mut_const operator+(difference_type, missing_plus_iter_diff_mut_const&);
223 friend missing_plus_iter_diff_mut_const operator+(difference_type, const missing_plus_iter_diff_mut_const&) = delete;
224 };
225
226 struct missing_minus_iter_diff_const : valid_random_access_iterator<missing_minus_iter_diff_const> {
227 friend missing_minus_iter_diff_const operator-(missing_minus_iter_diff_const&, difference_type);
228 friend missing_minus_iter_diff_const operator-(const missing_minus_iter_diff_const&, difference_type) = delete;
229 };
230
231 struct missing_minus_iter_iter : valid_random_access_iterator<missing_minus_iter_iter> {
232 friend missing_minus_iter_iter operator-(missing_minus_iter_iter, missing_minus_iter_iter) = delete;
233 };
234
235 struct missing_minus_const_iter_iter : valid_random_access_iterator<missing_minus_const_iter_iter> {
236 friend difference_type operator-(missing_minus_const_iter_iter&, missing_minus_const_iter_iter);
237 friend difference_type operator-(const missing_minus_const_iter_iter&, missing_minus_const_iter_iter) = delete;
238 };
239
240 struct missing_minus_iter_const_iter : valid_random_access_iterator<missing_minus_iter_const_iter> {
241 friend difference_type operator-(missing_minus_iter_const_iter, missing_minus_iter_const_iter&);
242 friend difference_type operator-(missing_minus_iter_const_iter, const missing_minus_iter_const_iter&) = delete;
243 };
244
245 struct missing_minus_const_iter_const_iter : valid_random_access_iterator<missing_minus_const_iter_const_iter> {
246 friend difference_type operator-(missing_minus_const_iter_const_iter&, missing_minus_const_iter_const_iter&);
247 friend difference_type operator-(const missing_minus_const_iter_const_iter&, missing_minus_const_iter_const_iter&);
248 friend difference_type operator-(missing_minus_const_iter_const_iter&, const missing_minus_const_iter_const_iter&);
249 friend difference_type operator-(const missing_minus_const_iter_const_iter&, const missing_minus_const_iter_const_iter&) = delete;
250 };
251
252 struct missing_subscript_operator : valid_random_access_iterator<missing_subscript_operator> {
253 int& operator[](difference_type) = delete;
254 };
255
256 struct missing_const_subscript_operator : valid_random_access_iterator<missing_const_subscript_operator> {
257 int& operator[](difference_type);
258 int& operator[](difference_type) const = delete;
259 };
260
261 struct missing_less : valid_random_access_iterator<missing_less> {
262 friend bool operator<(missing_less, missing_less) = delete;
263 };
264
265 struct missing_const_mut_less : valid_random_access_iterator<missing_const_mut_less> {
266 friend bool operator<(missing_const_mut_less&, missing_const_mut_less&);
267 friend bool operator<(missing_const_mut_less&, const missing_const_mut_less&);
268 friend bool operator<(const missing_const_mut_less&, missing_const_mut_less&) = delete;
269 friend bool operator<(const missing_const_mut_less&, const missing_const_mut_less&);
270 };
271
272 struct missing_mut_const_less : valid_random_access_iterator<missing_mut_const_less> {
273 friend bool operator<(missing_mut_const_less&, missing_mut_const_less&);
274 friend bool operator<(missing_mut_const_less&, const missing_mut_const_less&) = delete;
275 friend bool operator<(const missing_mut_const_less&, missing_mut_const_less&);
276 friend bool operator<(const missing_mut_const_less&, const missing_mut_const_less&);
277 };
278
279 struct missing_const_const_less : valid_random_access_iterator<missing_const_const_less> {
280 friend bool operator<(missing_const_const_less&, missing_const_const_less&);
281 friend bool operator<(missing_const_const_less&, const missing_const_const_less&);
282 friend bool operator<(const missing_const_const_less&, missing_const_const_less&);
283 friend bool operator<(const missing_const_const_less&, const missing_const_const_less&) = delete;
284 };
285
286 struct missing_greater : valid_random_access_iterator<missing_greater> {
287 friend bool operator>(missing_greater, missing_greater) = delete;
288 };
289
290 struct missing_const_mut_greater : valid_random_access_iterator<missing_const_mut_greater> {
291 friend bool operator>(missing_const_mut_greater&, missing_const_mut_greater&);
292 friend bool operator>(missing_const_mut_greater&, const missing_const_mut_greater&);
293 friend bool operator>(const missing_const_mut_greater&, missing_const_mut_greater&) = delete;
294 friend bool operator>(const missing_const_mut_greater&, const missing_const_mut_greater&);
295 };
296
297 struct missing_mut_const_greater : valid_random_access_iterator<missing_mut_const_greater> {
298 friend bool operator>(missing_mut_const_greater&, missing_mut_const_greater&);
299 friend bool operator>(missing_mut_const_greater&, const missing_mut_const_greater&) = delete;
300 friend bool operator>(const missing_mut_const_greater&, missing_mut_const_greater&);
301 friend bool operator>(const missing_mut_const_greater&, const missing_mut_const_greater&);
302 };
303
304 struct missing_const_const_greater : valid_random_access_iterator<missing_const_const_greater> {
305 friend bool operator>(missing_const_const_greater&, missing_const_const_greater&);
306 friend bool operator>(missing_const_const_greater&, const missing_const_const_greater&);
307 friend bool operator>(const missing_const_const_greater&, missing_const_const_greater&);
308 friend bool operator>(const missing_const_const_greater&, const missing_const_const_greater&) = delete;
309 };
310
311 struct missing_less_eq : valid_random_access_iterator<missing_less_eq> {
312 friend bool operator<=(missing_less_eq, missing_less_eq) = delete;
313 };
314
315 struct missing_const_mut_less_eq : valid_random_access_iterator<missing_const_mut_less_eq> {
316 friend bool operator<=(missing_const_mut_less_eq&, missing_const_mut_less_eq&);
317 friend bool operator<=(missing_const_mut_less_eq&, const missing_const_mut_less_eq&);
318 friend bool operator<=(const missing_const_mut_less_eq&, missing_const_mut_less_eq&) = delete;
319 friend bool operator<=(const missing_const_mut_less_eq&, const missing_const_mut_less_eq&);
320 };
321
322 struct missing_mut_const_less_eq : valid_random_access_iterator<missing_mut_const_less_eq> {
323 friend bool operator<=(missing_mut_const_less_eq&, missing_mut_const_less_eq&);
324 friend bool operator<=(missing_mut_const_less_eq&, const missing_mut_const_less_eq&) = delete;
325 friend bool operator<=(const missing_mut_const_less_eq&, missing_mut_const_less_eq&);
326 friend bool operator<=(const missing_mut_const_less_eq&, const missing_mut_const_less_eq&);
327 };
328
329 struct missing_const_const_less_eq : valid_random_access_iterator<missing_const_const_less_eq> {
330 friend bool operator<=(missing_const_const_less_eq&, missing_const_const_less_eq&);
331 friend bool operator<=(missing_const_const_less_eq&, const missing_const_const_less_eq&);
332 friend bool operator<=(const missing_const_const_less_eq&, missing_const_const_less_eq&);
333 friend bool operator<=(const missing_const_const_less_eq&, const missing_const_const_less_eq&) = delete;
334 };
335
336 struct missing_greater_eq : valid_random_access_iterator<missing_greater_eq> {
337 friend bool operator>=(missing_greater_eq, missing_greater_eq) = delete;
338 };
339
340 struct missing_const_mut_greater_eq : valid_random_access_iterator<missing_const_mut_greater_eq> {
341 friend bool operator>=(missing_const_mut_greater_eq&, missing_const_mut_greater_eq&);
342 friend bool operator>=(missing_const_mut_greater_eq&, const missing_const_mut_greater_eq&);
343 friend bool operator>=(const missing_const_mut_greater_eq&, missing_const_mut_greater_eq&) = delete;
344 friend bool operator>=(const missing_const_mut_greater_eq&, const missing_const_mut_greater_eq&);
345 };
346
347 struct missing_mut_const_greater_eq : valid_random_access_iterator<missing_mut_const_greater_eq> {
348 friend bool operator>=(missing_mut_const_greater_eq&, missing_mut_const_greater_eq&);
349 friend bool operator>=(missing_mut_const_greater_eq&, const missing_mut_const_greater_eq&) = delete;
350 friend bool operator>=(const missing_mut_const_greater_eq&, missing_mut_const_greater_eq&);
351 friend bool operator>=(const missing_mut_const_greater_eq&, const missing_mut_const_greater_eq&);
352 };
353
354 struct missing_const_const_greater_eq : valid_random_access_iterator<missing_const_const_greater_eq> {
355 friend bool operator>=(missing_const_const_greater_eq&, missing_const_const_greater_eq&);
356 friend bool operator>=(missing_const_const_greater_eq&, const missing_const_const_greater_eq&);
357 friend bool operator>=(const missing_const_const_greater_eq&, missing_const_const_greater_eq&);
358 friend bool operator>=(const missing_const_const_greater_eq&, const missing_const_const_greater_eq&) = delete;
359 };
360
check_random_access_iterator()361 void check_random_access_iterator() {
362 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_equals); // expected-error {{static assertion failed}}
363 // expected-note@*:* {{because '__iter += __n' would be invalid: overload resolution selected deleted operator '+='}}
364 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_equals); // expected-error {{static assertion failed}}
365 // expected-note@*:* {{because '__iter -= __n' would be invalid: overload resolution selected deleted operator '-='}}
366 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_iter_diff); // expected-error {{static assertion failed}}
367 // expected-note@*:* {{because '__iter + __n' would be invalid: overload resolution selected deleted operator '+'}}
368 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_diff_iter); // expected-error {{static assertion failed}}
369 // expected-note@*:* {{because '__n + __iter' would be invalid: overload resolution selected deleted operator '+'}}
370 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_iter_diff_const_mut); // expected-error {{static assertion failed}}
371 // expected-note@*:* {{because 'std::as_const(__iter) + __n' would be invalid: overload resolution selected deleted operator '+'}}
372 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_iter_diff_mut_const); // expected-error {{static assertion failed}}
373 // expected-note@*:* {{because '__n + std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '+'}}
374 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_iter_diff_const); // expected-error {{static assertion failed}}
375 // expected-note@*:* {{because 'std::as_const(__iter) - __n' would be invalid: overload resolution selected deleted operator '-'}}
376 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_iter_iter); // expected-error {{static assertion failed}}
377 // expected-note@*:* {{because '__iter - __iter' would be invalid: overload resolution selected deleted operator '-'}}
378 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_const_iter_iter); // expected-error {{static assertion failed}}
379 // expected-note@*:* {{because 'std::as_const(__iter) - __iter' would be invalid: overload resolution selected deleted operator '-'}}
380 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_iter_const_iter); // expected-error {{static assertion failed}}
381 // expected-note@*:* {{because '__iter - std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '-'}}
382 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_const_iter_const_iter); // expected-error {{static assertion failed}}
383 // expected-note@*:* {{because 'std::as_const(__iter) - std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '-'}}
384 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_subscript_operator); // expected-error {{static assertion failed}}
385 // expected-note@*:* {{because '__iter[__n]' would be invalid: overload resolution selected deleted operator '[]'}}
386 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_subscript_operator); // expected-error {{static assertion failed}}
387 // expected-note@*:* {{because 'std::as_const(__iter)[__n]' would be invalid: overload resolution selected deleted operator '[]'}}
388 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_less); // expected-error {{static assertion failed}}
389 // expected-note@*:* {{because '__iter < __iter' would be invalid: overload resolution selected deleted operator '<'}}
390 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_less); // expected-error {{static assertion failed}}
391 // expected-note@*:* {{because 'std::as_const(__iter) < __iter' would be invalid: overload resolution selected deleted operator '<'}}
392 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_less); // expected-error {{static assertion failed}}
393 // expected-note@*:* {{because '__iter < std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<'}}
394 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_less); // expected-error {{static assertion failed}}
395 // expected-note@*:* {{because 'std::as_const(__iter) < std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<'}}
396 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_greater); // expected-error {{static assertion failed}}
397 // expected-note@*:* {{because '__iter > __iter' would be invalid: overload resolution selected deleted operator '>'}}
398 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_greater); // expected-error {{static assertion failed}}
399 // expected-note@*:* {{because 'std::as_const(__iter) > __iter' would be invalid: overload resolution selected deleted operator '>'}}
400 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_greater); // expected-error {{static assertion failed}}
401 // expected-note@*:* {{because '__iter > std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>'}}
402 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_greater); // expected-error {{static assertion failed}}
403 // expected-note@*:* {{because 'std::as_const(__iter) > std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>'}}
404 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_less_eq); // expected-error {{static assertion failed}}
405 // expected-note@*:* {{because '__iter <= __iter' would be invalid: overload resolution selected deleted operator '<='}}
406 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_less_eq); // expected-error {{static assertion failed}}
407 // expected-note@*:* {{because 'std::as_const(__iter) <= __iter' would be invalid: overload resolution selected deleted operator '<='}}
408 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_less_eq); // expected-error {{static assertion failed}}
409 // expected-note@*:* {{because '__iter <= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<='}}
410 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_less_eq); // expected-error {{static assertion failed}}
411 // expected-note@*:* {{because 'std::as_const(__iter) <= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<='}}
412 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_greater_eq); // expected-error {{static assertion failed}}
413 // expected-note@*:* {{because '__iter >= __iter' would be invalid: overload resolution selected deleted operator '>='}}
414 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_greater_eq); // expected-error {{static assertion failed}}
415 // expected-note@*:* {{because 'std::as_const(__iter) >= __iter' would be invalid: overload resolution selected deleted operator '>='}}
416 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_greater_eq); // expected-error {{static assertion failed}}
417 // expected-note@*:* {{because '__iter >= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>='}}
418 _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_greater_eq); // expected-error {{static assertion failed}}
419 // expected-note@*:* {{because 'std::as_const(__iter) >= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>='}}
420 }
421