Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/checkstl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,10 @@ void CheckStl::checkAutoPointer()
autoPointerArrayError(tok2->next());
}
}
autoPtrVarId.insert(tok2->next()->varId());
if (tok2->next()->varId())
{
autoPtrVarId.insert(tok2->next()->varId());
}
break;
}
tok2 = tok2->next();
Expand Down
6 changes: 6 additions & 0 deletions test/teststl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,12 @@ class TestStl : public TestFixture
"}\n");
ASSERT_EQUALS("[test.cpp:6]: (style) Copy 'auto_ptr' pointer to another do not create two equal objects since one has lost its ownership of the pointer.\n", errout.str());

check("std::auto_ptr<A> function();\n"
"int quit;"
"void f() { quit = true; }\n"
);
ASSERT_EQUALS("", errout.str());

// ticket #748
check("void f() \n"
"{\n"
Expand Down