Compiler Error C3897

'var' : only static initonly data members can have an initializer expression

An initonly data member can be initialized at declaration only if it is also static.

The following sample generates C3897:

// C3897.cpp
// compile with: /clr /c
ref struct Y1 {
   initonly int data_var1 = 9;   // C3897

   initonly static int data_var2 = 9;   // OK

   initonly int data_var3;   // declare initonly instance
   Y1() { data_var3 = 99; }   // initialize initonly instance
};