// S : tags c++ $TAGS // S : expect --result valid // S : cc -o test.bc $CC_OPT $file // S : verify $V_OPT -o nofail:vfs test.bc #include #include #include #include #include struct X { ~X() { char buf[4] = { 0 }; int r = write( 42, buf, 4 ); assert( r == -1 ); assert( errno == EBADF ); std::printf( "~X, exception=%d\n", int( std::uncaught_exception() ) ); } }; void bar() { throw 0; } void foo() { X x; bar(); } int main() { try { foo(); } catch ( ... ) { return 0; } return 1; }