Attempt to increment a Boolean value

The CWARN.BOOLOP.INC checker finds attempts to increment or decrement a Boolean value.

Vulnerability and risk

Using increment or decrement operations with a Boolean true/false value has no effect.

Vulnerable code example

  #include <iostream>
  using namespace std;
  void foo() {
    bool b = true;
  int main() { 
    return 0;

Klocwork flags the attempt to increment Boolean variable 'b' at line 5.