Adam Balogh | 2cfbe93 | 2018-08-28 08:41:15 +0000 | [diff] [blame^] | 1 | // RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.InvalidatedIterator -analyzer-eagerly-assume -analyzer-config aggressive-relational-comparison-simplification=true -analyzer-config c++-container-inlining=false %s -verify |
| 2 | // RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.InvalidatedIterator -analyzer-eagerly-assume -analyzer-config aggressive-relational-comparison-simplification=true -analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify |
| 3 | |
| 4 | #include "Inputs/system-header-simulator-cxx.h" |
| 5 | |
| 6 | void bad_copy_assign_operator_list1(std::list<int> &L1, |
| 7 | const std::list<int> &L2) { |
| 8 | auto i0 = L1.cbegin(); |
| 9 | L1 = L2; |
| 10 | *i0; // expected-warning{{Invalidated iterator accessed}} |
| 11 | } |
| 12 | |
| 13 | void bad_copy_assign_operator_vector1(std::vector<int> &V1, |
| 14 | const std::vector<int> &V2) { |
| 15 | auto i0 = V1.cbegin(); |
| 16 | V1 = V2; |
| 17 | *i0; // expected-warning{{Invalidated iterator accessed}} |
| 18 | } |
| 19 | |
| 20 | void bad_copy_assign_operator_deque1(std::deque<int> &D1, |
| 21 | const std::deque<int> &D2) { |
| 22 | auto i0 = D1.cbegin(); |
| 23 | D1 = D2; |
| 24 | *i0; // expected-warning{{Invalidated iterator accessed}} |
| 25 | } |
| 26 | |
| 27 | void bad_copy_assign_operator_forward_list1(std::forward_list<int> &FL1, |
| 28 | const std::forward_list<int> &FL2) { |
| 29 | auto i0 = FL1.cbegin(); |
| 30 | FL1 = FL2; |
| 31 | *i0; // expected-warning{{Invalidated iterator accessed}} |
| 32 | } |