Fix FP containerOutOfBounds with std::map (#4230)
This commit is contained in:
parent
f1212e66f7
commit
60c1eef659
|
@ -128,7 +128,7 @@ void CheckStl::outOfBounds()
|
||||||
for (const Scope *function : mTokenizer->getSymbolDatabase()->functionScopes) {
|
for (const Scope *function : mTokenizer->getSymbolDatabase()->functionScopes) {
|
||||||
for (const Token *tok = function->bodyStart; tok != function->bodyEnd; tok = tok->next()) {
|
for (const Token *tok = function->bodyStart; tok != function->bodyEnd; tok = tok->next()) {
|
||||||
const Library::Container *container = getLibraryContainer(tok);
|
const Library::Container *container = getLibraryContainer(tok);
|
||||||
if (!container)
|
if (!container || container->stdAssociativeLike)
|
||||||
continue;
|
continue;
|
||||||
const Token * parent = astParentSkipParens(tok);
|
const Token * parent = astParentSkipParens(tok);
|
||||||
const Token* accessTok = parent;
|
const Token* accessTok = parent;
|
||||||
|
|
|
@ -854,6 +854,12 @@ private:
|
||||||
" return d;\n"
|
" return d;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkNormal("std::string f() {\n"
|
||||||
|
" std::map<int, std::string> m = { { 1, \"1\" } };\n"
|
||||||
|
" return m.at(1);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void outOfBoundsSymbolic()
|
void outOfBoundsSymbolic()
|
||||||
|
|
Loading…
Reference in New Issue