Compiler Error C2149

 

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

identifier' : named bit field cannot have zero width

Bit fields can have zero width only if unnamed.

The following sample generates C2149:

// C2149.cpp  
// compile with: /c  
struct C {  
   int i : 0;   // C2149  
   int j : 2;   // OK  
};  

Show: