The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Compiler Error C2716
'operator new' allocates value types on the C++ heap; use '__nogc new type'
The syntax of an object instantiation was incorrect.
C2716 is only reachable using /clr:oldSyntax.
The following sample generates C2716:
// C2716.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
__value struct V {};
int main() {
V *pV = new V; // C2716
V *pV1 = __nogc new V; // OK
}
Show: