parent
2d5cabed4b
commit
6e1cc11eff
|
@ -483,12 +483,13 @@ static bool iscast(const Token *tok, bool cpp)
|
|||
const Token *tok3 = tok2->linkAt(1);
|
||||
while (tok3 != tok2 && Token::Match(tok3, "[{}]"))
|
||||
tok3 = tok3->previous();
|
||||
return tok3 != tok2 && tok3->str() != ";";
|
||||
return tok3->str() != ";";
|
||||
}
|
||||
return type || tok2->strAt(-1) == "*" || Token::simpleMatch(tok2, ") ~") ||
|
||||
const bool res = type || tok2->strAt(-1) == "*" || Token::simpleMatch(tok2, ") ~") ||
|
||||
(Token::Match(tok2, ") %any%") &&
|
||||
(!tok2->next()->isOp() || Token::Match(tok2->next(), "!|~|++|--")) &&
|
||||
!Token::Match(tok2->next(), "[[]);,?:.]"));
|
||||
return res;
|
||||
}
|
||||
|
||||
if (Token::Match(tok2, "&|&& )"))
|
||||
|
|
|
@ -6387,6 +6387,8 @@ private:
|
|||
|
||||
ASSERT_EQUALS("xp(= 12>34:?", testAst("x = ( const char ( * ) [ 1 > 2 ? 3 : 4 ] ) p ;"));
|
||||
|
||||
ASSERT_EQUALS("f{(si.,(", testAst("f((struct S){ }, s->i);")); // #11606
|
||||
|
||||
// not cast
|
||||
ASSERT_EQUALS("AB||", testAst("(A)||(B)"));
|
||||
ASSERT_EQUALS("abc[1&=", testAst("a = (b[c]) & 1;"));
|
||||
|
|
Loading…
Reference in New Issue