Muistiinpano
Tälle sivulle pääsy edellyttää valtuutusta. Voit yrittää kirjautua sisään tai vaihtaa hakemistoja.
Tälle sivulle pääsy edellyttää valtuutusta. Voit yrittää vaihtaa hakemistoja.
'var' : the initializer for a literal data member must be a constant expression
Remarks
A literal data member can only be initialized with a constant expresion.
Example
The following example generates C3887:
// C3887.cpp
// compile with: /clr
ref struct Y1 {
static int i = 9;
literal
int staticConst = i; // C3887
};
Possible resolution:
// C3887b.cpp
// compile with: /clr /c
ref struct Y1 {
literal
int staticConst = 9;
};