Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
| test.cpp:89:15:89:16 | it | Elements of $@ not accessed with valid reference, pointer, or iterator because of a prior $@. | test.cpp:86:20:86:20 | d | container | test.cpp:92:7:92:12 | call to insert | invalidation |
| test.cpp:91:9:91:10 | it | Elements of $@ not accessed with valid reference, pointer, or iterator because of a prior $@. | test.cpp:86:20:86:20 | d | container | test.cpp:92:7:92:12 | call to insert | invalidation |
| test.cpp:98:56:98:58 | loc | Elements of $@ not accessed with valid reference, pointer, or iterator because of a prior $@. | test.cpp:96:44:96:46 | str | container | test.cpp:99:9:99:14 | call to insert | invalidation |
| test.cpp:99:5:99:7 | str | Elements of $@ not accessed with valid reference, pointer, or iterator because of a prior $@. | test.cpp:96:44:96:46 | str | container | test.cpp:99:9:99:14 | call to insert | invalidation |
| test.cpp:99:16:99:18 | loc | Elements of $@ not accessed with valid reference, pointer, or iterator because of a prior $@. | test.cpp:96:44:96:46 | str | container | test.cpp:99:9:99:14 | call to insert | invalidation |
| test.cpp:106:11:106:13 | str | Elements of $@ not accessed with valid reference, pointer, or iterator because of a prior $@. | test.cpp:103:45:103:47 | str | container | test.cpp:106:15:106:20 | call to insert | invalidation |
4 changes: 2 additions & 2 deletions cpp/common/test/rules/validcontainerelementaccess/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ void f8(const int *ar) {
void f9(const std::string &s, std::string &str) {
std::string::iterator loc = str.begin();
for (auto i = s.begin(), e = s.end(); i != e; ++i, ++loc) { // NON_COMPLIANT
str.insert(loc, 'c'); // NON_COMPLIANT
str.insert(loc, 'c'); // NON_COMPLIANT[FALSE POSITIVE for str]
}
}

void f10(const std::string &s, std::string &str) {
std::string::iterator loc = str.begin();
for (auto i = s.begin(), e = s.end(); i != e; ++i, ++loc) { // COMPLIANT
loc = str.insert(loc, 'c'); // COMPLIANT
loc = str.insert(loc, 'c'); // COMPLIANT[FALSE POSITIVE]
}
}

Expand Down