This documentation is archived and is not being maintained.

Compiler Error C3895

Error Message

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

Certain kinds of data members, for example literal or initonly, cannot be volatile (C++).

The following sample generates C3895:

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