Compiler Error C2150

 

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 C2150.

identifier' : bit field must have type 'int', 'signed int', or 'unsigned int'

bit fields are required to be int, signed``int, or unsigned``int.

The following sample generates C2150:

// C2150.cpp  
// compile with: /c  
struct A {  
   float a : 8;    // C2150  
   int i : 8;   // OK  
};  

Show: