Erro do compilador C2749
'type': só pode lançar ou capturar um identificador para uma classe gerenciada com /clr:safe
Ao usar /clr:safe, você só pode lançar ou capturar um tipo de referência.
Para obter mais informações, consulte /clr (compilação de Common Language Runtime).
Exemplo
O seguinte exemplo gera o erro C2749:
// C2749.cpp
// compile with: /clr:safe
ref struct MyStruct {
public:
int i;
};
int main() {
MyStruct ^x = gcnew MyStruct;
// Delete the following 4 lines to resolve.
try {
throw (1); // C2749
}
catch(int){}
// OK
try {
throw (x);
}
catch(MyStruct ^){}
}