Compiler Error C2428

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C2428.

operation' : not allowed on operand of type 'bool'

You cannot apply a decrement operator to objects of type bool.

The following sample generates C2428:

// C2428.cpp  
void g(bool fFlag) {  
   --fFlag;   // C2428  
   fFlag--;   // C2428  
}  

Show: