Compiler Error C3152

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C3152.

construct' : 'keyword' can only be applied to a class, struct, or virtual member function

Certain keywords can only be applied to a C++ class.

The following sample generates C3152 and shows how to fix it:

// C3152.cpp  
// compile with: /clr /c  
ref class C {  
   int (*pfn)() sealed;   // C3152  
   virtual int g() sealed;   // OK  
};  

The following sample generates C3152 and shows how to fix it:

// C3152_2.cpp  
// compile with: /clr:oldSyntax /c  
__value __interface A {};   // C3152;  
__value class X {};   // OK  

Show: