Fixed #5072 (False positive: comparisonOfBoolWithInvalidComparator even without explicit bool type)
This commit is contained in:
parent
a0015fc2f4
commit
023d0e7cb8
|
@ -380,7 +380,7 @@ static bool isNonBoolLHSExpr(const Token *tok)
|
|||
nonBoolExpr = true;
|
||||
else if (tok->isArithmeticalOp())
|
||||
nonBoolExpr = true;
|
||||
else if (tok->str() == "!" || tok->isComparisonOp())
|
||||
else if (tok->isComparisonOp() || (tok->str() == "!" && tok->previous()->str()=="("))
|
||||
return false;
|
||||
else if (indentlevel == 0 && Token::Match(tok,"[;{}=?:&|^,]"))
|
||||
break;
|
||||
|
|
|
@ -306,6 +306,9 @@ private:
|
|||
" if (error == ABC) { }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int f() { return !a+b<c; }");
|
||||
ASSERT_EQUALS("",errout.str());
|
||||
}
|
||||
|
||||
void comparisonOfBoolExpressionWithInt2() {
|
||||
|
|
Loading…
Reference in New Issue