Export (0) Print
Expand All
Expand Minimize

Compiler Error C3623

'variable': bit fields are not supported in managed types

The use of bit fields is not permitted on variables in a managed class.

The following sample generates C3623:

// C3623.cpp
// compile with: /clr
using namespace System;
ref class CMyClass {
public:
   int i : 1;   // C3623
};

int main() {
   CMyClass^ pMyClass = gcnew CMyClass();
   pMyClass->i = 3;
   Console::Out->WriteLine(pMyClass->i);
}

The following sample generates C3623:

// C3623_2.cpp
// compile with: /clr:oldSyntax
using namespace System;
__gc class CMyClass {
   public:
      int i : 1;   // C3623
};

int main() {
   CMyClass *pMyClass = new CMyClass();
   pMyClass->i = 3;
   Console::Out->WriteLine(pMyClass->i);
}
Show:
© 2014 Microsoft