Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket 11403: Added tests #6677

Merged
merged 1 commit into from
Aug 10, 2024
Merged
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
27 changes: 27 additions & 0 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5178,3 +5178,30 @@ struct S_std_as_const { // #12974
}
std::list<int> l;
};

void containerOutOfBounds_std_string(std::string &var) { // #11403
std::string s0{"x"};
// cppcheck-suppress containerOutOfBounds
var+= s0[2];

std::string s1{ R"(x)" };
// cppcheck-suppress containerOutOfBounds
var+= s1[2];

std::string s2 = R"--(XYZ)--";
// cppcheck-suppress containerOutOfBounds
var+= s2[3];

std::string s3 = {R"--(XYZ)--"};
// cppcheck-suppress containerOutOfBounds
var+= s3[3];

const char *x = R"--(XYZ)--";
std::string s4(x);
// TODO cppcheck-suppress containerOutOfBounds
var+= s4[3];

std::string s5{x};
// TODO cppcheck-suppress containerOutOfBounds
var+= s5[3];
}
Loading