#include<set>intmain()
{
std::set<int>s;if(constautoit=s.find(1); it != s.end()) {}return0;
}
This generates a warning with cppcheck 1.88:
~ $ cppcheck --enable=all cppcheck.cpp
Checking cppcheck.cpp ... [cppcheck.cpp:5]: (warning) Suspicious condition. The result of find() is an iterator, but it is not properly checked.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for reporting the issue.
It looks like there is already a ticket for such issues: https://trac.cppcheck.net/ticket/9486
I will add your code as another example for the false positive issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is also another ticket which is already fixed: https://trac.cppcheck.net/ticket/9630
I closed ticket 9486 as a duplicate one.
That is why I can reproduce the issue with Cppcheck 1.90 but not with the latest development code.
So with the next release (I guess 2.00) the issue is fixed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This generates a warning with cppcheck 1.88:
Thanks for reporting the issue.
It looks like there is already a ticket for such issues: https://trac.cppcheck.net/ticket/9486
I will add your code as another example for the false positive issue.
There is also another ticket which is already fixed: https://trac.cppcheck.net/ticket/9630
I closed ticket 9486 as a duplicate one.
That is why I can reproduce the issue with Cppcheck 1.90 but not with the latest development code.
So with the next release (I guess 2.00) the issue is fixed.