Fixed #7659 (crash: Token::varId() : vxl: brdb_selection.cxx)
This commit is contained in:
parent
3e509fb561
commit
a8df08f22b
|
@ -168,7 +168,9 @@ void CheckStl::iterators()
|
|||
// inserting iterator range..
|
||||
if (tok2->strAt(2) == "insert") {
|
||||
const Token *par2 = itTok->nextArgument();
|
||||
while (par2 && par2->str() != ")") {
|
||||
if (!par2 || par2->nextArgument())
|
||||
continue;
|
||||
while (par2->str() != ")") {
|
||||
if (par2->varId() == container->declarationId())
|
||||
break;
|
||||
if (par2->str() == "(")
|
||||
|
|
|
@ -209,6 +209,23 @@ private:
|
|||
" l2.insert(it, l1.end());\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// only warn for insert when there are preciself 2 arguments.
|
||||
check("void foo() {\n"
|
||||
" list<int> l1;\n"
|
||||
" list<int> l2;\n"
|
||||
" list<int>::iterator it = l1.begin();\n"
|
||||
" l2.insert(it);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
check("void foo() {\n"
|
||||
" list<int> l1;\n"
|
||||
" list<int> l2;\n"
|
||||
" list<int>::iterator it = l1.begin();\n"
|
||||
" l2.insert(it,0,1);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
}
|
||||
|
||||
void iterator4() {
|
||||
|
|
Loading…
Reference in New Issue