The following code results in a containerOutOfBounds error in cppcheck 2.8.
#include <iostream> #include <vector> #include <cstdlib> [[noreturn]] void fatal() { exit(1); } class FatalStream { public: [[noreturn]] ~FatalStream() { fatal(); } }; int main() { std::vector<int> v; if (v.empty()) { FatalStream{}; } std::cout << v[0] << '\n'; return 0; }
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11375
Log in to post a comment.
The following code results in a containerOutOfBounds error in cppcheck 2.8.
Last edit: Mark Bourgeault 2022-11-02
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11375