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 | |
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 | static_assert(std::__cpp17_iterator<not_move_constructible>); // expected-error {{static assertion failed}} |
93 | // expected-note@*:* {{because 'not_move_constructible' does not satisfy '__cpp17_move_constructible'}} |
94 | |
95 | static_assert(std::__cpp17_iterator<not_copy_constructible>); // expected-error {{static assertion failed}} |
96 | // expected-note@*:* {{because 'not_copy_constructible' does not satisfy '__cpp17_copy_constructible'}} |
97 | |
98 | static_assert(std::__cpp17_iterator<not_move_assignable>); // expected-error {{static assertion failed}} |
99 | // expected-note@*:* {{because 'not_move_assignable' does not satisfy '__cpp17_copy_assignable'}} |
100 | |
101 | static_assert(std::__cpp17_iterator<not_copy_assignable>); // expected-error {{static assertion failed}} |
102 | // expectted-note@*:* {{because 'not_copy_assignable' does not satisfy '__cpp17_copy_assignable'}} |
103 | |
104 | static_assert(std::__cpp17_iterator<diff_t_not_signed>); // expected-error {{static assertion failed}} |
105 | // expectted-note@*:* {{'is_signed_v<__iter_diff_t<diff_t_not_signed> >' evaluated to false}} |
106 | } |
107 | |
108 | struct not_equality_comparable : valid_iterator<not_equality_comparable> {}; |
109 | bool operator==(not_equality_comparable, not_equality_comparable) = delete; |
110 | bool operator!=(not_equality_comparable, not_equality_comparable); |
111 | |
112 | struct not_unequality_comparable : valid_iterator<not_unequality_comparable> {}; |
113 | bool operator==(not_unequality_comparable, not_unequality_comparable); |
114 | bool operator!=(not_unequality_comparable, not_unequality_comparable) = delete; |
115 | |
116 | void check_input_iterator_requirements() { |
117 | // clang-format off |
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 | // clang-format on |
124 | } |
125 | |
126 | template <class Derived> |
127 | struct valid_forward_iterator : valid_iterator<Derived> { |
128 | Derived& operator++(); |
129 | Derived operator++(int); |
130 | |
131 | friend bool operator==(Derived, Derived); |
132 | }; |
133 | |
134 | struct not_default_constructible : valid_forward_iterator<not_default_constructible> { |
135 | not_default_constructible() = delete; |
136 | }; |
137 | |
138 | struct postincrement_not_ref : valid_iterator<postincrement_not_ref> {}; |
139 | bool operator==(postincrement_not_ref, postincrement_not_ref); |
140 | |
141 | void check_forward_iterator_requirements() { |
142 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(not_default_constructible, "" ); // expected-error {{static assertion failed}} |
143 | // expected-note@*:* {{because 'not_default_constructible' does not satisfy '__cpp17_default_constructible'}} |
144 | _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(postincrement_not_ref, "" ); // expected-error {{static assertion failed}} |
145 | #ifndef _AIX |
146 | // expected-note@*:* {{because type constraint 'convertible_to<valid_iterator<postincrement_not_ref>::Proxy, const postincrement_not_ref &>' was not satisfied}} |
147 | #endif |
148 | } |
149 | |
150 | struct missing_predecrement : valid_forward_iterator<missing_predecrement> { |
151 | missing_deref operator--(int); |
152 | }; |
153 | |
154 | struct missing_postdecrement : valid_forward_iterator<missing_postdecrement> { |
155 | missing_postdecrement& operator--(); |
156 | }; |
157 | |
158 | struct not_returning_iter_reference : valid_forward_iterator<not_returning_iter_reference> { |
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 | |
169 | void check_bidirectional_iterator_requirements() { |
170 | // clang-format off |
171 | _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(missing_predecrement, "" ); // expected-error {{static assertion failed}} |
172 | // expected-note@*:* {{cannot decrement value of type 'missing_predecrement'}} |
173 | _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(missing_postdecrement, "" ); // expected-error {{static assertion failed}} |
174 | // expected-note@*:* {{cannot decrement value of type 'missing_postdecrement'}} |
175 | _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(not_returning_iter_reference, "" ); // expected-error {{static assertion failed}} |
176 | // expected-note@*:* {{because type constraint 'same_as<int, __iter_reference<not_returning_iter_reference> >' was not satisfied}} |
177 | // clang-format on |
178 | } |
179 | |
180 | template <class Derived> |
181 | struct valid_random_access_iterator : valid_forward_iterator<Derived> { |
182 | using difference_type = typename valid_forward_iterator<Derived>::difference_type; |
183 | |
184 | Derived& operator--(); |
185 | Derived operator--(int); |
186 | |
187 | Derived& operator+=(difference_type); |
188 | Derived& operator-=(difference_type); |
189 | |
190 | friend Derived operator+(valid_random_access_iterator, difference_type); |
191 | friend Derived operator+(difference_type, valid_random_access_iterator); |
192 | friend Derived operator-(valid_random_access_iterator, difference_type); |
193 | friend Derived operator-(difference_type, valid_random_access_iterator); |
194 | friend difference_type operator-(valid_random_access_iterator, valid_random_access_iterator); |
195 | |
196 | int& operator[](difference_type) const; |
197 | |
198 | friend std::strong_ordering operator<=>(Derived, Derived); |
199 | }; |
200 | |
201 | struct missing_plus_equals : valid_random_access_iterator<missing_plus_equals> { |
202 | void operator+=(difference_type) = delete; |
203 | }; |
204 | |
205 | struct missing_minus_equals : valid_random_access_iterator<missing_minus_equals> { |
206 | void operator-=(difference_type) = delete; |
207 | }; |
208 | |
209 | struct missing_plus_iter_diff : valid_random_access_iterator<missing_plus_iter_diff> { |
210 | void operator+(difference_type) = delete; |
211 | }; |
212 | |
213 | struct missing_plus_diff_iter : valid_random_access_iterator<missing_plus_diff_iter> { |
214 | friend missing_plus_diff_iter operator+(difference_type, missing_plus_diff_iter) = delete; |
215 | }; |
216 | |
217 | struct missing_plus_iter_diff_const_mut : valid_random_access_iterator<missing_plus_iter_diff_const_mut> { |
218 | friend missing_plus_iter_diff_const_mut operator+(missing_plus_iter_diff_const_mut&, difference_type); |
219 | friend missing_plus_iter_diff_const_mut operator+(const missing_plus_iter_diff_const_mut&, difference_type) = delete; |
220 | }; |
221 | |
222 | struct missing_plus_iter_diff_mut_const : valid_random_access_iterator<missing_plus_iter_diff_mut_const> { |
223 | friend missing_plus_iter_diff_mut_const operator+(missing_plus_iter_diff_mut_const, difference_type); |
224 | friend missing_plus_iter_diff_mut_const operator+(difference_type, missing_plus_iter_diff_mut_const&); |
225 | friend missing_plus_iter_diff_mut_const operator+(difference_type, const missing_plus_iter_diff_mut_const&) = delete; |
226 | }; |
227 | |
228 | struct missing_minus_iter_diff_const : valid_random_access_iterator<missing_minus_iter_diff_const> { |
229 | friend missing_minus_iter_diff_const operator-(missing_minus_iter_diff_const&, difference_type); |
230 | friend missing_minus_iter_diff_const operator-(const missing_minus_iter_diff_const&, difference_type) = delete; |
231 | }; |
232 | |
233 | struct missing_minus_iter_iter : valid_random_access_iterator<missing_minus_iter_iter> { |
234 | friend missing_minus_iter_iter operator-(missing_minus_iter_iter, missing_minus_iter_iter) = delete; |
235 | }; |
236 | |
237 | struct missing_minus_const_iter_iter : valid_random_access_iterator<missing_minus_const_iter_iter> { |
238 | friend difference_type operator-(missing_minus_const_iter_iter&, missing_minus_const_iter_iter); |
239 | friend difference_type operator-(const missing_minus_const_iter_iter&, missing_minus_const_iter_iter) = delete; |
240 | }; |
241 | |
242 | struct missing_minus_iter_const_iter : valid_random_access_iterator<missing_minus_iter_const_iter> { |
243 | friend difference_type operator-(missing_minus_iter_const_iter, missing_minus_iter_const_iter&); |
244 | friend difference_type operator-(missing_minus_iter_const_iter, const missing_minus_iter_const_iter&) = delete; |
245 | }; |
246 | |
247 | struct missing_minus_const_iter_const_iter : valid_random_access_iterator<missing_minus_const_iter_const_iter> { |
248 | friend difference_type operator-(missing_minus_const_iter_const_iter&, missing_minus_const_iter_const_iter&); |
249 | friend difference_type operator-(const missing_minus_const_iter_const_iter&, missing_minus_const_iter_const_iter&); |
250 | friend difference_type operator-(missing_minus_const_iter_const_iter&, const missing_minus_const_iter_const_iter&); |
251 | friend difference_type |
252 | operator-(const missing_minus_const_iter_const_iter&, const missing_minus_const_iter_const_iter&) = delete; |
253 | }; |
254 | |
255 | struct missing_subscript_operator : valid_random_access_iterator<missing_subscript_operator> { |
256 | int& operator[](difference_type) = delete; |
257 | }; |
258 | |
259 | struct missing_const_subscript_operator : valid_random_access_iterator<missing_const_subscript_operator> { |
260 | int& operator[](difference_type); |
261 | int& operator[](difference_type) const = delete; |
262 | }; |
263 | |
264 | struct missing_less : valid_random_access_iterator<missing_less> { |
265 | friend bool operator<(missing_less, missing_less) = delete; |
266 | }; |
267 | |
268 | struct missing_const_mut_less : valid_random_access_iterator<missing_const_mut_less> { |
269 | friend bool operator<(missing_const_mut_less&, missing_const_mut_less&); |
270 | friend bool operator<(missing_const_mut_less&, const missing_const_mut_less&); |
271 | friend bool operator<(const missing_const_mut_less&, missing_const_mut_less&) = delete; |
272 | friend bool operator<(const missing_const_mut_less&, const missing_const_mut_less&); |
273 | }; |
274 | |
275 | struct missing_mut_const_less : valid_random_access_iterator<missing_mut_const_less> { |
276 | friend bool operator<(missing_mut_const_less&, missing_mut_const_less&); |
277 | friend bool operator<(missing_mut_const_less&, const missing_mut_const_less&) = delete; |
278 | friend bool operator<(const missing_mut_const_less&, missing_mut_const_less&); |
279 | friend bool operator<(const missing_mut_const_less&, const missing_mut_const_less&); |
280 | }; |
281 | |
282 | struct missing_const_const_less : valid_random_access_iterator<missing_const_const_less> { |
283 | friend bool operator<(missing_const_const_less&, missing_const_const_less&); |
284 | friend bool operator<(missing_const_const_less&, const missing_const_const_less&); |
285 | friend bool operator<(const missing_const_const_less&, missing_const_const_less&); |
286 | friend bool operator<(const missing_const_const_less&, const missing_const_const_less&) = delete; |
287 | }; |
288 | |
289 | struct missing_greater : valid_random_access_iterator<missing_greater> { |
290 | friend bool operator>(missing_greater, missing_greater) = delete; |
291 | }; |
292 | |
293 | struct missing_const_mut_greater : valid_random_access_iterator<missing_const_mut_greater> { |
294 | friend bool operator>(missing_const_mut_greater&, missing_const_mut_greater&); |
295 | friend bool operator>(missing_const_mut_greater&, const missing_const_mut_greater&); |
296 | friend bool operator>(const missing_const_mut_greater&, missing_const_mut_greater&) = delete; |
297 | friend bool operator>(const missing_const_mut_greater&, const missing_const_mut_greater&); |
298 | }; |
299 | |
300 | struct missing_mut_const_greater : valid_random_access_iterator<missing_mut_const_greater> { |
301 | friend bool operator>(missing_mut_const_greater&, missing_mut_const_greater&); |
302 | friend bool operator>(missing_mut_const_greater&, const missing_mut_const_greater&) = delete; |
303 | friend bool operator>(const missing_mut_const_greater&, missing_mut_const_greater&); |
304 | friend bool operator>(const missing_mut_const_greater&, const missing_mut_const_greater&); |
305 | }; |
306 | |
307 | struct missing_const_const_greater : valid_random_access_iterator<missing_const_const_greater> { |
308 | friend bool operator>(missing_const_const_greater&, missing_const_const_greater&); |
309 | friend bool operator>(missing_const_const_greater&, const missing_const_const_greater&); |
310 | friend bool operator>(const missing_const_const_greater&, missing_const_const_greater&); |
311 | friend bool operator>(const missing_const_const_greater&, const missing_const_const_greater&) = delete; |
312 | }; |
313 | |
314 | struct missing_less_eq : valid_random_access_iterator<missing_less_eq> { |
315 | friend bool operator<=(missing_less_eq, missing_less_eq) = delete; |
316 | }; |
317 | |
318 | struct missing_const_mut_less_eq : valid_random_access_iterator<missing_const_mut_less_eq> { |
319 | friend bool operator<=(missing_const_mut_less_eq&, missing_const_mut_less_eq&); |
320 | friend bool operator<=(missing_const_mut_less_eq&, const missing_const_mut_less_eq&); |
321 | friend bool operator<=(const missing_const_mut_less_eq&, missing_const_mut_less_eq&) = delete; |
322 | friend bool operator<=(const missing_const_mut_less_eq&, const missing_const_mut_less_eq&); |
323 | }; |
324 | |
325 | struct missing_mut_const_less_eq : valid_random_access_iterator<missing_mut_const_less_eq> { |
326 | friend bool operator<=(missing_mut_const_less_eq&, missing_mut_const_less_eq&); |
327 | friend bool operator<=(missing_mut_const_less_eq&, const missing_mut_const_less_eq&) = delete; |
328 | friend bool operator<=(const missing_mut_const_less_eq&, missing_mut_const_less_eq&); |
329 | friend bool operator<=(const missing_mut_const_less_eq&, const missing_mut_const_less_eq&); |
330 | }; |
331 | |
332 | struct missing_const_const_less_eq : valid_random_access_iterator<missing_const_const_less_eq> { |
333 | friend bool operator<=(missing_const_const_less_eq&, missing_const_const_less_eq&); |
334 | friend bool operator<=(missing_const_const_less_eq&, const missing_const_const_less_eq&); |
335 | friend bool operator<=(const missing_const_const_less_eq&, missing_const_const_less_eq&); |
336 | friend bool operator<=(const missing_const_const_less_eq&, const missing_const_const_less_eq&) = delete; |
337 | }; |
338 | |
339 | struct missing_greater_eq : valid_random_access_iterator<missing_greater_eq> { |
340 | friend bool operator>=(missing_greater_eq, missing_greater_eq) = delete; |
341 | }; |
342 | |
343 | struct missing_const_mut_greater_eq : valid_random_access_iterator<missing_const_mut_greater_eq> { |
344 | friend bool operator>=(missing_const_mut_greater_eq&, missing_const_mut_greater_eq&); |
345 | friend bool operator>=(missing_const_mut_greater_eq&, const missing_const_mut_greater_eq&); |
346 | friend bool operator>=(const missing_const_mut_greater_eq&, missing_const_mut_greater_eq&) = delete; |
347 | friend bool operator>=(const missing_const_mut_greater_eq&, const missing_const_mut_greater_eq&); |
348 | }; |
349 | |
350 | struct missing_mut_const_greater_eq : valid_random_access_iterator<missing_mut_const_greater_eq> { |
351 | friend bool operator>=(missing_mut_const_greater_eq&, missing_mut_const_greater_eq&); |
352 | friend bool operator>=(missing_mut_const_greater_eq&, const missing_mut_const_greater_eq&) = delete; |
353 | friend bool operator>=(const missing_mut_const_greater_eq&, missing_mut_const_greater_eq&); |
354 | friend bool operator>=(const missing_mut_const_greater_eq&, const missing_mut_const_greater_eq&); |
355 | }; |
356 | |
357 | struct missing_const_const_greater_eq : valid_random_access_iterator<missing_const_const_greater_eq> { |
358 | friend bool operator>=(missing_const_const_greater_eq&, missing_const_const_greater_eq&); |
359 | friend bool operator>=(missing_const_const_greater_eq&, const missing_const_const_greater_eq&); |
360 | friend bool operator>=(const missing_const_const_greater_eq&, missing_const_const_greater_eq&); |
361 | friend bool operator>=(const missing_const_const_greater_eq&, const missing_const_const_greater_eq&) = delete; |
362 | }; |
363 | |
364 | void check_random_access_iterator() { |
365 | // clang-format off |
366 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_equals, "" ); // 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_minus_equals, "" ); // expected-error {{static assertion failed}} |
369 | // expected-note@*:* {{because '__iter -= __n' would be invalid: overload resolution selected deleted operator '-='}} |
370 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_iter_diff, "" ); // expected-error {{static assertion failed}} |
371 | // expected-note@*:* {{because '__iter + __n' would be invalid: overload resolution selected deleted operator '+'}} |
372 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_diff_iter, "" ); // expected-error {{static assertion failed}} |
373 | // expected-note@*:* {{because '__n + __iter' would be invalid: overload resolution selected deleted operator '+'}} |
374 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_iter_diff_const_mut, "" ); // 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_plus_iter_diff_mut_const, "" ); // expected-error {{static assertion failed}} |
377 | // expected-note@*:* {{because '__n + std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '+'}} |
378 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_iter_diff_const, "" ); // expected-error {{static assertion failed}} |
379 | // expected-note@*:* {{because 'std::as_const(__iter) - __n' would be invalid: overload resolution selected deleted operator '-'}} |
380 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_iter_iter, "" ); // expected-error {{static assertion failed}} |
381 | // expected-note@*:* {{because '__iter - __iter' would be invalid: overload resolution selected deleted operator '-'}} |
382 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_const_iter_iter, "" ); // expected-error {{static assertion failed}} |
383 | // expected-note@*:* {{because 'std::as_const(__iter) - __iter' would be invalid: overload resolution selected deleted operator '-'}} |
384 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_iter_const_iter, "" ); // expected-error {{static assertion failed}} |
385 | // expected-note@*:* {{because '__iter - std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '-'}} |
386 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_const_iter_const_iter, "" ); // expected-error {{static assertion failed}} |
387 | // expected-note@*:* {{because 'std::as_const(__iter) - std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '-'}} |
388 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_subscript_operator, "" ); // expected-error {{static assertion failed}} |
389 | // expected-note@*:* {{because '__iter[__n]' would be invalid: overload resolution selected deleted operator '[]'}} |
390 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_subscript_operator, "" ); // expected-error {{static assertion failed}} |
391 | // expected-note@*:* {{because 'std::as_const(__iter)[__n]' would be invalid: overload resolution selected deleted operator '[]'}} |
392 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_less, "" ); // expected-error {{static assertion failed}} |
393 | // expected-note@*:* {{because '__iter < __iter' would be invalid: overload resolution selected deleted operator '<'}} |
394 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_less, "" ); // expected-error {{static assertion failed}} |
395 | // expected-note@*:* {{because 'std::as_const(__iter) < __iter' would be invalid: overload resolution selected deleted operator '<'}} |
396 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_less, "" ); // expected-error {{static assertion failed}} |
397 | // expected-note@*:* {{because '__iter < std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<'}} |
398 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_less, "" ); // expected-error {{static assertion failed}} |
399 | // expected-note@*:* {{because 'std::as_const(__iter) < std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<'}} |
400 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_greater, "" ); // expected-error {{static assertion failed}} |
401 | // expected-note@*:* {{because '__iter > __iter' would be invalid: overload resolution selected deleted operator '>'}} |
402 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_greater, "" ); // expected-error {{static assertion failed}} |
403 | // expected-note@*:* {{because 'std::as_const(__iter) > __iter' would be invalid: overload resolution selected deleted operator '>'}} |
404 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_greater, "" ); // expected-error {{static assertion failed}} |
405 | // expected-note@*:* {{because '__iter > std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>'}} |
406 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_greater, "" ); // expected-error {{static assertion failed}} |
407 | // expected-note@*:* {{because 'std::as_const(__iter) > std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>'}} |
408 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_less_eq, "" ); // expected-error {{static assertion failed}} |
409 | // expected-note@*:* {{because '__iter <= __iter' would be invalid: overload resolution selected deleted operator '<='}} |
410 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_less_eq, "" ); // expected-error {{static assertion failed}} |
411 | // expected-note@*:* {{because 'std::as_const(__iter) <= __iter' would be invalid: overload resolution selected deleted operator '<='}} |
412 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_less_eq, "" ); // expected-error {{static assertion failed}} |
413 | // expected-note@*:* {{because '__iter <= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<='}} |
414 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_less_eq, "" ); // expected-error {{static assertion failed}} |
415 | // expected-note@*:* {{because 'std::as_const(__iter) <= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<='}} |
416 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_greater_eq, "" ); // expected-error {{static assertion failed}} |
417 | // expected-note@*:* {{because '__iter >= __iter' would be invalid: overload resolution selected deleted operator '>='}} |
418 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_greater_eq, "" ); // expected-error {{static assertion failed}} |
419 | // expected-note@*:* {{because 'std::as_const(__iter) >= __iter' would be invalid: overload resolution selected deleted operator '>='}} |
420 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_greater_eq, "" ); // expected-error {{static assertion failed}} |
421 | // expected-note@*:* {{because '__iter >= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>='}} |
422 | _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_greater_eq, "" ); // expected-error {{static assertion failed}} |
423 | // expected-note@*:* {{because 'std::as_const(__iter) >= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>='}} |
424 | // clang-format on |
425 | } |
426 | |