diff --git a/sdk/lib/ucrt/inc/internal_shared.h b/sdk/lib/ucrt/inc/internal_shared.h index 7ad4b4bafe3..a0f1a5a841e 100644 --- a/sdk/lib/ucrt/inc/internal_shared.h +++ b/sdk/lib/ucrt/inc/internal_shared.h @@ -206,10 +206,31 @@ struct __crt_seh_guarded_call template T operator()(Init init, Action action, Cleanup cleanup) { + T result; init(); __try { - return action(); + result = action(); + } + __finally + { + cleanup(); + } + __endtry + return result; + } +}; + +template<> +struct __crt_seh_guarded_call +{ + template + void operator()(Init init, Action action, Cleanup cleanup) + { + init(); + __try + { + action(); } __finally {