fix 2846 (false positive for auto_ptr check with container element)
This commit is contained in:
parent
47a15b6486
commit
172903cde4
|
@ -1138,7 +1138,7 @@ void CheckStl::checkAutoPointer()
|
|||
tok3 = tok3->next();
|
||||
}
|
||||
tok3 = tok3->previous()->previous();
|
||||
if (Token::Match(tok3, "] )"))
|
||||
if (Token::Match(tok3->previous(), "[ ] )"))
|
||||
{
|
||||
autoPointerArrayError(tok2->next());
|
||||
}
|
||||
|
|
|
@ -1321,6 +1321,15 @@ private:
|
|||
void autoPointer()
|
||||
{
|
||||
|
||||
// ticket 2846
|
||||
check("void f()\n"
|
||||
"{\n"
|
||||
" std::vector<int*> vec;\n"
|
||||
" vec.push_back(new int(3));\n"
|
||||
" std::auto_ptr<int> ret(vec[0]);\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// ticket 2839
|
||||
check("template <class MUTEX_TYPE>\n"
|
||||
"class Guarded\n"
|
||||
|
|
Loading…
Reference in New Issue