[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / stl-algorithm-modeling.cpp
blob5549c24a8c220f523f61942c6388ab406ae85134
1 // RUN: %clang_analyze_cc1 -std=c++17 %s\
2 // RUN: -analyzer-checker=core,cplusplus,alpha.cplusplus.STLAlgorithmModeling,debug.DebugIteratorModeling,debug.ExprInspection\
3 // RUN: -analyzer-config aggressive-binary-operation-simplification=true\
4 // RUN: -verify
6 #include "Inputs/system-header-simulator-cxx.h"
8 void clang_analyzer_eval(bool);
10 template <typename Iterator>
11 long clang_analyzer_iterator_position(const Iterator&);
13 template <typename Iter> Iter return_any_iterator(const Iter &It);
15 void test_find1(std::vector<int> V, int n) {
16 const auto i1 = return_any_iterator(V.begin());
17 const auto i2 = return_any_iterator(V.begin());
19 const auto i3 = std::find(i1, i2, n);
21 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}
23 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
24 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
25 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
26 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
28 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
29 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
30 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
31 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
34 void test_find2(std::vector<int> V, int n) {
35 const auto i1 = return_any_iterator(V.begin());
36 const auto i2 = return_any_iterator(V.begin());
38 const auto i3 = std::find(std::execution::sequenced_policy(), i1, i2, n);
40 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
42 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
43 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
44 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
45 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
47 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
48 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
49 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
50 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
53 bool odd(int i) { return i % 2; }
55 void test_find_if1(std::vector<int> V) {
56 const auto i1 = return_any_iterator(V.begin());
57 const auto i2 = return_any_iterator(V.begin());
59 const auto i3 = std::find_if(i1, i2, odd);
61 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
63 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
64 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
65 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
66 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
68 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
69 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
70 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
71 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
74 void test_find_if2(std::vector<int> V) {
75 const auto i1 = return_any_iterator(V.begin());
76 const auto i2 = return_any_iterator(V.begin());
78 const auto i3 = std::find_if(std::execution::sequenced_policy(), i1, i2, odd);
80 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
82 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
83 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
84 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
85 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
87 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
88 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
89 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
90 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
93 void test_find_if_not1(std::vector<int> V) {
94 const auto i1 = return_any_iterator(V.begin());
95 const auto i2 = return_any_iterator(V.begin());
97 const auto i3 = std::find_if_not(i1, i2, odd);
99 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
101 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
102 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
103 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
104 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
106 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
107 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
108 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
109 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
112 void test_find_if_not2(std::vector<int> V) {
113 const auto i1 = return_any_iterator(V.begin());
114 const auto i2 = return_any_iterator(V.begin());
116 const auto i3 = std::find_if_not(std::execution::sequenced_policy(), i1, i2,
117 odd);
119 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
121 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
122 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
123 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
124 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
126 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
127 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
128 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
129 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
132 void test_find_first_of1(std::vector<int> V1, std::vector<int> V2) {
133 const auto i1 = return_any_iterator(V1.begin());
134 const auto i2 = return_any_iterator(V1.begin());
135 const auto i3 = return_any_iterator(V2.begin());
136 const auto i4 = return_any_iterator(V2.begin());
138 const auto i5 = std::find_first_of(i1, i2, i3, i4);
140 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
142 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
143 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
144 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
145 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
147 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
148 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
149 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
150 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
153 void test_find_first_of2(std::vector<int> V1, std::vector<int> V2) {
154 const auto i1 = return_any_iterator(V1.begin());
155 const auto i2 = return_any_iterator(V1.begin());
156 const auto i3 = return_any_iterator(V2.begin());
157 const auto i4 = return_any_iterator(V2.begin());
159 const auto i5 = std::find_first_of(std::execution::sequenced_policy(),
160 i1, i2, i3, i4);
162 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
164 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
165 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
166 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
167 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
169 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
170 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
171 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
172 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
175 void test_find_first_of3(std::vector<int> V1, std::vector<int> V2) {
176 const auto i1 = return_any_iterator(V1.begin());
177 const auto i2 = return_any_iterator(V1.begin());
178 const auto i3 = return_any_iterator(V2.begin());
179 const auto i4 = return_any_iterator(V2.begin());
181 const auto i5 = std::find_first_of(i1, i2, i3, i4, odd);
183 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
185 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
186 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
187 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
188 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
190 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
191 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
192 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
193 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
196 void test_find_first_of4(std::vector<int> V1, std::vector<int> V2) {
197 const auto i1 = return_any_iterator(V1.begin());
198 const auto i2 = return_any_iterator(V1.begin());
199 const auto i3 = return_any_iterator(V2.begin());
200 const auto i4 = return_any_iterator(V2.begin());
202 const auto i5 = std::find_first_of(std::execution::sequenced_policy(),
203 i1, i2, i3, i4, odd);
205 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
207 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
208 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
209 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
210 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
212 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
213 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
214 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
215 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
218 void test_find_end1(std::vector<int> V1, std::vector<int> V2) {
219 const auto i1 = return_any_iterator(V1.begin());
220 const auto i2 = return_any_iterator(V1.begin());
221 const auto i3 = return_any_iterator(V2.begin());
222 const auto i4 = return_any_iterator(V2.begin());
224 const auto i5 = std::find_end(i1, i2, i3, i4);
226 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
228 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
229 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
230 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
231 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
233 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
234 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
235 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
236 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
239 void test_find_end2(std::vector<int> V1, std::vector<int> V2) {
240 const auto i1 = return_any_iterator(V1.begin());
241 const auto i2 = return_any_iterator(V1.begin());
242 const auto i3 = return_any_iterator(V2.begin());
243 const auto i4 = return_any_iterator(V2.begin());
245 const auto i5 = std::find_end(std::execution::sequenced_policy(),
246 i1, i2, i3, i4);
248 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
250 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
251 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
252 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
253 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
255 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
256 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
257 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
258 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
261 void test_find_end3(std::vector<int> V1, std::vector<int> V2) {
262 const auto i1 = return_any_iterator(V1.begin());
263 const auto i2 = return_any_iterator(V1.begin());
264 const auto i3 = return_any_iterator(V2.begin());
265 const auto i4 = return_any_iterator(V2.begin());
267 const auto i5 = std::find_end(i1, i2, i3, i4, odd);
269 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
271 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
272 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
273 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
274 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
276 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
277 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
278 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
279 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
282 void test_find_end4(std::vector<int> V1, std::vector<int> V2) {
283 const auto i1 = return_any_iterator(V1.begin());
284 const auto i2 = return_any_iterator(V1.begin());
285 const auto i3 = return_any_iterator(V2.begin());
286 const auto i4 = return_any_iterator(V2.begin());
288 const auto i5 = std::find_end(std::execution::sequenced_policy(),
289 i1, i2, i3, i4, odd);
291 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
293 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
294 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
295 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
296 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
298 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
299 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
300 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
301 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
304 bool compare(int, int);
306 void test_lower_bound1(std::vector<int> V, int n) {
307 const auto i1 = return_any_iterator(V.begin());
308 const auto i2 = return_any_iterator(V.begin());
310 const auto i3 = std::lower_bound(i1, i2, n);
312 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
314 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
315 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
316 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
317 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
319 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
320 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
321 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
322 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
325 void test_lower_bound2(std::vector<int> V, int n) {
326 const auto i1 = return_any_iterator(V.begin());
327 const auto i2 = return_any_iterator(V.begin());
329 const auto i3 = std::lower_bound(i1, i2, n, compare);
331 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
333 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
334 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
335 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
336 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
338 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
339 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
340 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
341 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
344 void test_upper_bound1(std::vector<int> V, int n) {
345 const auto i1 = return_any_iterator(V.begin());
346 const auto i2 = return_any_iterator(V.begin());
348 const auto i3 = std::upper_bound(i1, i2, n);
350 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
352 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
353 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
354 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
355 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
357 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
358 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
359 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
360 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
363 void test_upper_bound2(std::vector<int> V, int n) {
364 const auto i1 = return_any_iterator(V.begin());
365 const auto i2 = return_any_iterator(V.begin());
367 const auto i3 = std::upper_bound(i1, i2, n, compare);
369 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
371 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
372 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
373 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
374 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
376 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
377 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
378 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
379 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
382 void test_search1(std::vector<int> V1, std::vector<int> V2) {
383 const auto i1 = return_any_iterator(V1.begin());
384 const auto i2 = return_any_iterator(V1.begin());
385 const auto i3 = return_any_iterator(V2.begin());
386 const auto i4 = return_any_iterator(V2.begin());
388 const auto i5 = std::search(i1, i2, i3, i4);
390 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
392 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
393 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
394 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
395 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
397 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
398 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
399 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
400 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
403 void test_search2(std::vector<int> V1, std::vector<int> V2) {
404 const auto i1 = return_any_iterator(V1.begin());
405 const auto i2 = return_any_iterator(V1.begin());
406 const auto i3 = return_any_iterator(V2.begin());
407 const auto i4 = return_any_iterator(V2.begin());
409 const auto i5 = std::search(std::execution::sequenced_policy(),
410 i1, i2, i3, i4);
412 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
414 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
415 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
416 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
417 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
419 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
420 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
421 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
422 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
425 void test_search3(std::vector<int> V1, std::vector<int> V2) {
426 const auto i1 = return_any_iterator(V1.begin());
427 const auto i2 = return_any_iterator(V1.begin());
428 const auto i3 = return_any_iterator(V2.begin());
429 const auto i4 = return_any_iterator(V2.begin());
431 const auto i5 = std::search(i1, i2, i3, i4, odd);
433 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
435 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
436 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
437 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
438 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
440 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
441 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
442 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
443 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
446 void test_search4(std::vector<int> V1, std::vector<int> V2) {
447 const auto i1 = return_any_iterator(V1.begin());
448 const auto i2 = return_any_iterator(V1.begin());
449 const auto i3 = return_any_iterator(V2.begin());
450 const auto i4 = return_any_iterator(V2.begin());
452 const auto i5 = std::search(std::execution::sequenced_policy(),
453 i1, i2, i3, i4, odd);
455 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
457 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
458 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
459 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
460 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
462 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
463 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
464 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
465 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
468 void test_search5(std::vector<int> V1, std::vector<int> V2) {
469 const auto i1 = return_any_iterator(V1.begin());
470 const auto i2 = return_any_iterator(V1.begin());
471 const auto i3 = return_any_iterator(V2.begin());
472 const auto i4 = return_any_iterator(V2.begin());
474 const auto i5 = std::search(i1, i2, std::default_searcher(i3, i4));
476 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
478 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
479 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
480 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
481 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
483 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
484 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
485 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
486 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
489 void test_search_n1(std::vector<int> V, int n) {
490 const auto i1 = return_any_iterator(V.begin());
491 const auto i2 = return_any_iterator(V.begin());
493 const auto i3 = std::search_n(i1, i2, 2, n);
495 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
497 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
498 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
499 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
500 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
502 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
503 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
504 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
505 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
508 void test_search_n2(std::vector<int> V, int n) {
509 const auto i1 = return_any_iterator(V.begin());
510 const auto i2 = return_any_iterator(V.begin());
512 const auto i3 = std::search_n(std::execution::sequenced_policy(),
513 i1, i2, 2, n);
515 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
518 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
519 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
520 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
521 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
523 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
524 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
525 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
526 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
529 void test_search_n3(std::vector<int> V, int n) {
530 const auto i1 = return_any_iterator(V.begin());
531 const auto i2 = return_any_iterator(V.begin());
533 const auto i3 = std::search_n(i1, i2, 2, n, compare);
535 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
537 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
538 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
539 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
540 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
542 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
543 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
544 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
545 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
548 void test_search_n4(std::vector<int> V, int n) {
549 const auto i1 = return_any_iterator(V.begin());
550 const auto i2 = return_any_iterator(V.begin());
552 const auto i3 = std::search_n(std::execution::sequenced_policy(),
553 i1, i2, 2, n, compare);
555 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
557 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
558 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
559 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
560 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
562 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
563 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
564 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
565 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}