diff --git a/cfg/std.cfg b/cfg/std.cfg index 83ab7f8e7..23616f160 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -6666,9 +6666,8 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun - + - false diff --git a/lib/astutils.cpp b/lib/astutils.cpp index d1e92ed93..f417ad704 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -2582,6 +2582,7 @@ bool isVariableChanged(const Token *tok, int indirect, const Settings *settings, Library::Container::Action::CHANGE_CONTENT, Library::Container::Action::CHANGE_INTERNAL, Library::Container::Action::CLEAR, + Library::Container::Action::FIND, Library::Container::Action::PUSH, Library::Container::Action::POP, Library::Container::Action::RESIZE}, diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 4952c79d8..81e5ba877 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -880,6 +880,14 @@ void std_unordered_map_emplace_unnitvar(std::unordered_set& u) u.emplace(i); } +int std_map_find_constref(std::map& m) // #11857 +{ + std::map& r = m; + std::map::iterator it = r.find(42); + int* p = &it->second; + return ++*p; +} + void valid_code() { std::vector vecInt{0, 1, 2};