We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2c7d986 commit 2543dc9Copy full SHA for 2543dc9
2 files changed
lib/checkbool.cpp
@@ -111,7 +111,7 @@ void CheckBool::checkBitwiseOnBoolean()
111
const bool isBoolOp2 = astIsBool(tok->astOperand2());
112
if (!(isBoolOp1 || isBoolOp2))
113
continue;
114
- if (isCompound && !isBoolOp1)
+ if (isCompound && (!isBoolOp1 || isBoolOp2))
115
116
if (tok->str() == "|" && !isConvertedToBool(tok) && !(isBoolOp1 && isBoolOp2))
117
test/testbool.cpp
@@ -949,6 +949,12 @@ class TestBool : public TestFixture {
949
" if (b || c) {}\n"
950
"}\n");
951
ASSERT_EQUALS("", errout.str());
952
+
953
+ check("bool f(bool b, int i) {\n"
954
+ " b &= (i == 5);\n"
955
+ " return b;\n"
956
+ "}\n");
957
+ ASSERT_EQUALS("", errout.str());
958
}
959
960
void incrementBoolean() {
0 commit comments