We recommend using Visual Studio 2017

Compiler Error C3895

 

The latest version of this topic can be found at 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  
};  

Show: