Edit

Share via


Compiler Error C3895

'var' : type data members cannot be 'volatile'

Certain kinds of data members, for example literal or initonly, cannot be volatile.

The following sample generates C3895:

// C3895.cpp
// compile with: /clr
ref struct Y1 {
   initonly
   volatile int data_var2;   // C3895
};