From 609ded941bc974e802fac577341c3eb5a231b7f7 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 20 Jul 2017 01:11:03 -0700 Subject: [PATCH] fixed bug in util::optional::reset(); forgot to set is_full to false --- src/util/optional.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/optional.h b/src/util/optional.h index 99b748d..c11ba78 100644 --- a/src/util/optional.h +++ b/src/util/optional.h @@ -80,6 +80,7 @@ struct Optional_base { if(is_full) full_value.~T(); + is_full = false; } template T &emplace(Types &&... args) noexcept(std::is_nothrow_constructible::value) @@ -179,6 +180,7 @@ struct Optional_base void reset() noexcept { // full_value.~T() not needed + is_full = false; } template T &emplace(Types &&... args) noexcept(std::is_nothrow_constructible::value) @@ -275,6 +277,7 @@ struct Optional_base void reset() noexcept { // full_value.~T() not needed + is_full = false; } template T &emplace(Types &&... args) noexcept(std::is_nothrow_constructible::value) -- 2.30.2