1 #include <cassert> 2 #include <cstdlib> 3 #include <exception> 4 expected_terminate()5void expected_terminate() { 6 exit(0); 7 } 8 throw_exception()9void throw_exception() { 10 // do nothing and return, so that std::terminate() can be invoked. 11 } 12 main()13int main() { 14 std::set_terminate(expected_terminate); 15 std::set_unexpected(throw_exception); 16 try { 17 std::unexpected(); 18 assert(false); 19 } catch (...) { 20 assert(false); 21 } 22 assert(false); 23 return 1; 24 } 25