Compiler Error C3168

 

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

type' : illegal underlying type for enum

The underlying type you specified for the enum type was not valid. The underlying type must be an integral C++ type or a corresponding CLR type.

The following sample generates C3168:

// C3168.cpp  
// compile with: /clr /c  
ref class G{};  
  
enum class E : G { e };   // C3168  
enum class F { f };   // OK  

The following sample generates C3168:

// C3168_2.cpp  
// compile with: /clr:oldSyntax /c  
__gc class G {};  
  
__value enum E : G {e};   // C3168  
__value enum F {f};   // OK  

Show: