Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <exception>
- namespace{
- struct foo{
- void change_state() noexcept
- {
- // change state and fail
- throw std::exception();
- }
- ~foo(){
- std::cout << "Destructor called, saved state corrupted!" <<std::endl;
- }
- };
- }
- int main(){
- ::std::set_terminate([](){
- std::cout<< "Terminate called" <<std::endl;
- });
- foo f;
- f.change_state();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement