Ticket #317 (closed defect: fixed)
Smart pointer methods in ptr.h throw nothing
| Reported by: | hugueswski | Owned by: | BruceDechant |
|---|---|---|---|
| Priority: | high | Milestone: | 2.1 |
| Component: | Server | Version: | 2.0.0 |
| Severity: | critical | Keywords: | |
| Cc: | External ID: | 1075218 |
Description
The throw of nothing is causing some problems in a sevral methods, like this one:
#ifdef _WIN32
T** operator&() throw(...)
#else
T** operator&()
#endif
{
if (p!=NULL)
throw; // ::Create(MgException::NLSGetMessage(_NLSID(_2_BADPARAMETER)));
return &p;
}
Notice that the throw statements are actually rethrow statements - these can't be caught by any catch statement. Here is a little test app showing that you can't catch this kind of throw statement even with catch(…). You always crash with an unhandled exception.
void f() throw(...) {
throw;
}
int main(int, char **) {
try {
f();
} catch(...) {
::std::cerr << "Caught an exception" << ::std::endl;
} return 1;
}
