컴파일러 오류 C2715
'type': 이 형식을 throw하거나 catch할 수 없습니다.
관리 코드에서 예외 처리를 사용하는 경우 값 형식이 잘못된 인수입니다(자세한 내용은 예외 처리 참조).
// C2715a.cpp
// compile with: /clr
using namespace System;
value struct V {
int i;
};
void f1() {
V v;
v.i = 10;
throw v; // C2715
// try the following line instead
// throw ((V^)v);
}
int main() {
try {
f1();
}
catch(V v) { if ( v.i == 10 ) { // C2715
// try the following line instead
// catch(V^ pv) { if ( pv->i == 10 ) {
Console::WriteLine("caught 10 - looks OK");
}
else {
Console::WriteLine("catch looks bad");
}
}
catch(...) {
Console::WriteLine("catch looks REALLY bad");
}
}