Opened 4 months ago
#296 new defect
Forgetting an exception vtable gives runtime crash
Reported by: | mlbrooks | Owned by: | |
---|---|---|---|
Priority: | minor | Component: | cfa-cc |
Version: | 1.0 | Keywords: | exception vtable |
Cc: |
Description ΒΆ
#if defined WITH_USER_FIX #define UFIX(...) __VA_ARGS__ // user adds this code, after understanding what the problem is #else #define UFIX(...) #endif exception E {}; UFIX( vtable(E) E_vt; ) int main() { try { throw (E){ UFIX( & E_vt ) }; } catch ( E * ) { } printf( "done\n" ); return 0; }
Actual: Runtime error, segment fault at memory location near zero
Expected: Compile warning or error, indicating cannot throw (E){}
-DWITH_USER_FIX
, actual and expected: print "done"
Note that a user learning CFA exceptions is likely to forget either a manual vtable declaration or to use Exception.hfa. Such a user is not well equipped to understand that the segment fault means the vtable is missing.
Mike would be satisfied by handling the problem case as: Error, no default ctor for E. Others may disagree.
Note: See
TracTickets for help on using
tickets.