From 9c4b0a3a174bd46fdac375aeade168eb03392a82 Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Mon, 29 Jan 2018 00:33:53 +0100 Subject: [PATCH] Fix the memory leak tested in 5751152733 --- include/continuable/detail/expected.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/continuable/detail/expected.hpp b/include/continuable/detail/expected.hpp index 658f498..9c624dd 100644 --- a/include/continuable/detail/expected.hpp +++ b/include/continuable/detail/expected.hpp @@ -194,6 +194,12 @@ public: expected& operator=(expected const&) = default; expected& operator=(expected&&) = default; + ~expected() noexcept( + std::is_nothrow_destructible::value&& + std::is_nothrow_destructible::value) { + weak_destroy(); + } + explicit expected(T value) // : expected(std::move(value), detail::slot_t::value) { }