Compiler Error C3255
'value type' : cannot dynamically allocate this value type object on native heap
Instances of a value type (see Classes and Structs) that contain managed members can be created on the stack but not on the heap.
The following sample generates C3255:
// C3255.cpp
// compile with: /clr
using namespace System;
value struct V {
Object^ o;
};
value struct V2 {
int i;
};
int main() {
V* pv = new V; // C3255
V2* pv2 = new V2;
V v2;
}