Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 1.1 KB

compiler-warning-c4368.md

File metadata and controls

37 lines (28 loc) · 1.1 KB
description title ms.date f1_keywords helpviewer_keywords
Learn more about: Compiler Warning (level 1, Error) C4368
Compiler Warning (level 1, Error) C4368
11/04/2016
C4368
C4368

Compiler Warning (level 1, Error) C4368

cannot define 'member' as a member of managed 'type': mixed types are not supported

You can't embed a native data member in a managed type.

You can, however, declare a pointer to a native type and control its lifetime in the constructor and destructor and finalizer of your managed class. For more information, see Destructors and finalizers.

This warning is always issued as an error. Use the warning pragma to disable C4368.

Example

The following sample generates C4368.

// C4368.cpp
// compile with: /clr /c
struct N {};
ref struct O {};
ref struct R {
    R() : m_p( new N ) {}
    ~R() { delete m_p; }

   property N prop;   // C4368
   int i[10];   // C4368

   property O ^ prop2;   // OK
   N * m_p;   // OK
};