Fix FP bitwiseOnBoolean (#4280)
This commit is contained in:
parent
2c7d98626a
commit
2543dc97d2
|
@ -111,7 +111,7 @@ void CheckBool::checkBitwiseOnBoolean()
|
||||||
const bool isBoolOp2 = astIsBool(tok->astOperand2());
|
const bool isBoolOp2 = astIsBool(tok->astOperand2());
|
||||||
if (!(isBoolOp1 || isBoolOp2))
|
if (!(isBoolOp1 || isBoolOp2))
|
||||||
continue;
|
continue;
|
||||||
if (isCompound && !isBoolOp1)
|
if (isCompound && (!isBoolOp1 || isBoolOp2))
|
||||||
continue;
|
continue;
|
||||||
if (tok->str() == "|" && !isConvertedToBool(tok) && !(isBoolOp1 && isBoolOp2))
|
if (tok->str() == "|" && !isConvertedToBool(tok) && !(isBoolOp1 && isBoolOp2))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -949,6 +949,12 @@ private:
|
||||||
" if (b || c) {}\n"
|
" if (b || c) {}\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("bool f(bool b, int i) {\n"
|
||||||
|
" b &= (i == 5);\n"
|
||||||
|
" return b;\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void incrementBoolean() {
|
void incrementBoolean() {
|
||||||
|
|
Loading…
Reference in New Issue