File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7689,6 +7689,14 @@ struct ContainerExpressionAnalyzer : ExpressionAnalyzer {
76897689 }
76907690 }
76917691
7692+ int getIndirect (const Token* tok) const override
7693+ {
7694+ if (tok->valueType ()) {
7695+ return tok->valueType ()->pointer ;
7696+ }
7697+ return ValueFlowAnalyzer::getIndirect (tok);
7698+ }
7699+
76927700 Action isModified (const Token* tok) const override {
76937701 Action read = Action::Read;
76947702 // An iterator won't change the container size
Original file line number Diff line number Diff line change @@ -886,6 +886,13 @@ class TestStl : public TestFixture {
886886 " v[0];\n "
887887 " }\n " );
888888 ASSERT_EQUALS (" " , errout.str ());
889+
890+ checkNormal (" void f(std::vector<int>* v) {\n "
891+ " if (v->empty())\n "
892+ " v->push_back(1);\n "
893+ " auto x = v->back();\n "
894+ " }\n " );
895+ ASSERT_EQUALS (" " , errout.str ());
889896 }
890897
891898 void outOfBoundsSymbolic ()
You can’t perform that action at this time.
0 commit comments