fix #2657 (segmentation fault of cppcheck ( gcc-testsuite: return f(){} ))
This commit is contained in:
parent
7b63da4964
commit
1de35c168d
|
@ -1455,7 +1455,7 @@ void Scope::getVariableList()
|
|||
// skip return and delete
|
||||
else if (Token::Match(tok, "return|delete"))
|
||||
{
|
||||
while (tok->next()->str() != ";")
|
||||
while (tok->next() && tok->next()->str() != ";")
|
||||
tok = tok->next();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -197,6 +197,7 @@ private:
|
|||
TEST_CASE(symboldatabase14); // ticket #2589
|
||||
TEST_CASE(symboldatabase15); // ticket #2591
|
||||
TEST_CASE(symboldatabase16); // ticket #2637
|
||||
TEST_CASE(symboldatabase17); // ticket #2657
|
||||
}
|
||||
|
||||
// Check the operator Equal
|
||||
|
@ -5805,6 +5806,14 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void symboldatabase17()
|
||||
{
|
||||
// ticket #2657 - segmentation fault
|
||||
checkConst("return f(){}\n");
|
||||
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestClass)
|
||||
|
|
Loading…
Reference in New Issue