Fix regression from first attempt fixing #5811 (9dce9bddcb)

This commit is contained in:
Alexander Mai 2014-05-17 19:14:29 +02:00
parent 9dce9bddcb
commit 91e7116de1
2 changed files with 11 additions and 0 deletions

View File

@ -886,6 +886,8 @@ void CheckNullPointer::nullConstantDereference()
if (Token::Match(tok2->previous(), ";|{|}|:|("))
break;
}
if (tok2->previous()->str()=="(")
continue;
if (Token::simpleMatch(tok2, "std :: cin"))
nullPointerError(tok);
if (tok2 && tok2->varId() != 0) {

View File

@ -2141,6 +2141,15 @@ private:
" return out.str();\n"
"}n", true, "test.cpp", false);
ASSERT_EQUALS("", errout.str());
// avoid regression from first fix attempt for #5811...
check("void deserialize(const std::string &data) {\n"
"std::istringstream iss(data);\n"
"unsigned int len = 0;\n"
"if (!(iss >> len))\n"
" return;\n"
"}\n", true, "test.cpp", false);
ASSERT_EQUALS("", errout.str());
}
void functioncall() { // #3443 - function calls