Export (0) Print
Expand All
Expand Minimize

Compiler Error C3842

'function': 'const' and 'volatile' qualifiers on member functions of managed types are not supported

const and volatile are not supported on member functions of managed types.

The following sample generates C3842:

// C3842a.cpp
// compile with: /clr /c
public ref struct A {
   void f() const {}   // C3842
   void f() volatile {}   // C3842

   void f() {}
};

The following sample generates C3842:

// C3842b.cpp
// compile with: /clr:oldSyntax /c
public __gc struct A {
   void f() const {}   // C3842
   void f() volatile  {}   // C3842

   void f()  {}
};

Community Additions

ADD
Show:
© 2014 Microsoft