Use of bitand on boolean operands (original) (raw)
The following code gives a warning as expected:
bool test(); int main() { return test() & test(); }
warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical])
However, this code also gives the same warning:
bool test(); int main() { return test() bitand test(); }
I believe it would be best not to give the warning in the second case. There is no risk of the second case being accidental typo. It would be a nice way of signaling the bitwise AND is intentional to the compiler, rather than casting one of the bools to an int.