Compiler Error C3880

 

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

var' : cannot be a literal data member

The type of a literal attribute must be, or compile-time convertible to, one of the following types:

  • integral type

  • string

  • enum with an integral or underlying type

The following sample generates C3880:

// C3880.cpp  
// compile with: /clr /c  
ref struct Y1 {  
   literal System::Decimal staticConst1 = 10;   // C3880  
   literal int staticConst2 = 10;   // OK  
};  

Show: