https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77490
Bug ID: 77490 Summary: bit-not (~) on boolean should be warned about Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: bernd.edlinger at hotmail dot de Target Milestone: --- see: https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00202.html The problem is that ~ on bool maps [0:1] to [-1:-2] and thus the result is no longer boolean. But probably the assignment normalizes the result again: b = ~b; has the effect of setting b = 1. this affects c and c++.