Errore del compilatore C2452
'type': tipo di origine non valido per safe_cast
Tipo di origine per safe_cast non valido. Ad esempio, tutti i tipi in un'operazione safe_cast
devono essere tipi CLR.
L'esempio seguente genera l'errore C2452:
// C2452.cpp
// compile with: /clr
struct A {};
struct B : public A {};
ref struct C {};
ref struct D : public C{};
int main() {
A a;
safe_cast<B*>(&a); // C2452
// OK
C ^ c = gcnew C;
safe_cast<D^>(c);
}