编译器错误 C3880

“var”:不能是 literal 数据成员

literal 属性类型必须是或在编译时可转换为以下类型之一:

  • 整型类型

  • string

  • 整型类型或基础类型的枚举

以下示例生成 C3880:

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