From fbfdb6af301557b8656ecc63ffd09098a4555cd6 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Mon, 17 Jun 2024 00:21:28 +0900 Subject: [PATCH] fix: call destructor correctly --- include/toml11/result.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/toml11/result.hpp b/include/toml11/result.hpp index c931aee5..234ebc1a 100644 --- a/include/toml11/result.hpp +++ b/include/toml11/result.hpp @@ -434,8 +434,12 @@ struct result #if defined(__GNUC__) && ! defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wduplicated-branches" +#endif + if(this->is_ok_) {this->succ.~success_type();} else {this->fail.~failure_type();} + +#if defined(__GNUC__) && ! defined(__clang__) #pragma GCC diagnostic pop #endif return;