fix #2887 (infinit loop with ( A::A(std::auto_ptr<X> e){} ))

This commit is contained in:
Robert Reif 2011-08-04 19:50:18 -04:00
parent 57a51128a4
commit 2516aad31d
2 changed files with 19 additions and 15 deletions

View File

@ -1138,8 +1138,8 @@ void CheckStl::checkAutoPointer()
{
tok3 = tok3->next();
}
if (!tok3)
continue;
if (tok3)
{
tok3 = tok3->previous()->previous();
if (Token::simpleMatch(tok3->previous(), "[ ] )"))
{
@ -1159,6 +1159,7 @@ void CheckStl::checkAutoPointer()
}
break;
}
}
tok2 = tok2->next();
}
}

View File

@ -1424,6 +1424,9 @@ private:
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. You should not use 'auto_ptr' for pointers obtained with operator 'new[]'.\n", errout.str());
// ticket #1887 infinite loop
check("A::A(std::auto_ptr<X> e){}\n");
ASSERT_EQUALS("", errout.str());
}