Fix #12618 FN variableScope with member or array access (#6301) · cppcheck-opensource/cppcheck@5c97641 · GitHub
Skip to content

Commit 5c97641

Browse files
Fix #12618 FN variableScope with member or array access (#6301)
1 parent c677fc8 commit 5c97641

3 files changed

Lines changed: 25 additions & 7 deletions

File tree

lib/checkother.cpp

Lines changed: 10 additions & 4 deletions

lib/valueflow.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8442,9 +8442,8 @@ bool ValueFlow::isContainerSizeChanged(const Token* tok, int indirect, const Set
84428442
return true;
84438443
if (astIsLHS(tok) && Token::Match(tok->astParent(), "%assign%|<<"))
84448444
return true;
8445-
const Library::Container* container = tok->valueType()->container;
84468445
if (astIsLHS(tok) && Token::simpleMatch(tok->astParent(), "["))
8447-
return container->stdAssociativeLike;
8446+
return tok->valueType()->container->stdAssociativeLike;
84488447
const Library::Container::Action action = astContainerAction(tok);
84498448
switch (action) {
84508449
case Library::Container::Action::RESIZE:

test/testother.cpp

Lines changed: 14 additions & 1 deletion

0 commit comments

Comments
 (0)