5 void println(const char* s) {
16 println("~drop_check");
24 void rust_catch_callback(void (*cb)(), bool* rust_ok);
26 static void callback() {
27 println("throwing C++ exception");
31 void throw_cxx_exception() {
34 rust_catch_callback(callback, &rust_ok);
35 assert(false && "unreachable");
36 } catch (exception e) {
37 println("caught C++ exception");
41 assert(false && "did not catch thrown C++ exception");
44 void cxx_catch_callback(void (*cb)(), bool* cxx_ok) {
49 } catch (rust_panic e) {
50 assert(false && "shouldn't be able to catch a rust panic");
52 println("caught foreign exception in catch (...)");
53 // Foreign exceptions are caught by catch (...). We only set the ok
54 // flag if we successfully caught the panic. The destructor of
55 // drop_check will then set the flag to true if it is executed.