Fixed crash on garbage code (#7356)

This commit is contained in:
PKEuS 2016-01-31 10:25:09 +01:00
parent c31f7c7a48
commit 0e8777ec99
2 changed files with 6 additions and 0 deletions

View File

@ -490,6 +490,8 @@ static const Token* doAssignment(Variables &variables, const Token *tok, bool de
tok = tok->next();
tok = tok->tokAt(2);
if (!tok)
return tokOld;
if (tok->str() == "&") {
addressOf = true;
tok = tok->next();

View File

@ -222,6 +222,7 @@ private:
TEST_CASE(garbageCode171);
TEST_CASE(garbageCode172);
TEST_CASE(garbageCode173); // #6781
TEST_CASE(garbageCode174); // #7356
TEST_CASE(garbageValueFlow);
TEST_CASE(garbageSymbolDatabase);
TEST_CASE(garbageAST);
@ -1460,6 +1461,9 @@ private:
ASSERT_THROW(checkCode(" template < Types > struct S : >( S < ...Types... > S <) > { ( ) { } } ( ) { return S < void > ( ) }"), InternalError);
}
void garbageCode174() { // #7356
checkCode("{r e() { w*constD = (())D = cast< }}");
}
};
REGISTER_TEST(TestGarbage)