parent
1f8896e51c
commit
8e79b0c8bc
|
@ -6022,7 +6022,7 @@ static void valueFlowIteratorInfer(TokenList *tokenlist, const Settings *setting
|
|||
return true;
|
||||
return false;
|
||||
});
|
||||
for(ValueFlow::Value& v:values) {
|
||||
for (ValueFlow::Value& v:values) {
|
||||
v.setPossible();
|
||||
if (v.isIteratorStartValue())
|
||||
v.intvalue++;
|
||||
|
|
|
@ -3662,7 +3662,7 @@ private:
|
|||
" if (*(i+1) == *i) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:4]: (warning) Either the condition 'i==v.end()' is redundant or there is possible dereference of an invalid iterator: i+1.\n", errout.str());
|
||||
|
||||
|
||||
check("void f(std::vector<int> & v) {\n"
|
||||
" std::vector<int>::iterator i= v.begin();\n"
|
||||
" if(i != v.end() && (i+1) != v.end() && *(i+1) == *i) {}\n"
|
||||
|
|
Loading…
Reference in New Issue