Compiler Error C2599


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

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

enum' : forward declaration of enum type is not allowed

The compiler no longer supports forward declaration of a managed enumeration.

Forward declaration of an enum type is not allowed under /Za.

The following sample generates C2599:

// C2599.cpp  
// compile with: /clr /c  
enum class Status;   // C2599  
enum class Status2 { stop2, hold2, go2};   
ref struct MyStruct {  
   // Delete the following line to resolve.  
   Status m_status;  
   Status2 m_status2;   // OK  
enum class Status { stop, hold, go };