parent
7b97230dd2
commit
d57d536f01
|
@ -566,7 +566,7 @@ static bool iscast(const Token *tok, bool cpp)
|
|||
}
|
||||
return type || tok2->strAt(-1) == "*" || Token::simpleMatch(tok2, ") ~") ||
|
||||
(Token::Match(tok2, ") %any%") &&
|
||||
!tok2->next()->isOp() &&
|
||||
(!tok2->next()->isOp() || Token::Match(tok2->next(), "!|~|++|--")) &&
|
||||
!Token::Match(tok2->next(), "[[]);,?:.]"));
|
||||
}
|
||||
|
||||
|
|
|
@ -555,6 +555,13 @@ private:
|
|||
" f(1, { static_cast<int*>(nullptr) });\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct S { int i; };\n" // #10882
|
||||
"enum E {};\n"
|
||||
"void f(const S* s) {\n"
|
||||
" E e = (E)!s->i;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void vardecl() {
|
||||
|
|
|
@ -6298,6 +6298,8 @@ private:
|
|||
|
||||
ASSERT_EQUALS("fon!(restoring01:?,(", testAst("f((long) !on, restoring ? 0 : 1);"));
|
||||
|
||||
ASSERT_EQUALS("esi.!(=", testAst("E e = (E)!s->i;")); // #10882
|
||||
|
||||
// not cast
|
||||
ASSERT_EQUALS("AB||", testAst("(A)||(B)"));
|
||||
ASSERT_EQUALS("abc[1&=", testAst("a = (b[c]) & 1;"));
|
||||
|
|
Loading…
Reference in New Issue