exceptions thrown by the deleter (#28), furthermore it's noexcept now.main
| @@ -75,11 +75,11 @@ namespace sr | |||
| other.release(); | |||
| } | |||
| ~scope_exit() | |||
| ~scope_exit() noexcept(true) | |||
| { | |||
| if( m_execute_on_destruction == true ) | |||
| { | |||
| call_deleter_safe(); | |||
| m_deleter(); | |||
| } | |||
| } | |||
| @@ -96,16 +96,6 @@ namespace sr | |||
| private: | |||
| void call_deleter_safe() noexcept | |||
| { | |||
| try | |||
| { | |||
| m_deleter(); | |||
| } | |||
| catch( ... ) { /* Empty */ } | |||
| } | |||
| Deleter m_deleter; | |||
| bool m_execute_on_destruction; | |||
| }; | |||
| @@ -157,10 +157,3 @@ TEST_CASE("move transfers state if released", "[ScopeExit]") | |||
| static_cast<void>(guard); | |||
| } | |||
| TEST_CASE("no exception propagation from deleter", "[ScopeExit]") | |||
| { | |||
| REQUIRE_NOTHROW([] { | |||
| auto guard = sr::make_scope_exit([] { throw std::exception{}; }); | |||
| static_cast<void>(guard); | |||
| }()); | |||
| } | |||