Fixed bad ast (wrong result from iscast())

This commit is contained in:
Daniel Marjamäki 2020-02-21 17:15:33 +01:00
parent c514818b65
commit 388b5118df
2 changed files with 3 additions and 1 deletions

View File

@ -445,7 +445,7 @@ static bool iscast(const Token *tok)
if (Token::Match(tok->link(), ") }|)|]|;")) if (Token::Match(tok->link(), ") }|)|]|;"))
return false; return false;
if (Token::Match(tok->link(), ") %cop%") && !Token::Match(tok->link(), ") [&*+-~]")) if (Token::Match(tok->link(), ") %cop%") && !Token::Match(tok->link(), ") [&*+-~!]"))
return false; return false;
if (Token::Match(tok->previous(), "= ( %name% ) {") && tok->next()->varId() == 0) if (Token::Match(tok->previous(), "= ( %name% ) {") && tok->next()->varId() == 0)

View File

@ -7808,6 +7808,8 @@ private:
ASSERT_EQUALS("yz.(return", testAst("return (x)(y).z;")); ASSERT_EQUALS("yz.(return", testAst("return (x)(y).z;"));
ASSERT_EQUALS("fon!(restoring01:?,(", testAst("f((long) !on, restoring ? 0 : 1);"));
// not cast // not cast
ASSERT_EQUALS("AB||", testAst("(A)||(B)")); ASSERT_EQUALS("AB||", testAst("(A)||(B)"));
ASSERT_EQUALS("abc[1&=", testAst("a = (b[c]) & 1;")); ASSERT_EQUALS("abc[1&=", testAst("a = (b[c]) & 1;"));