diff --git a/include/optional.hpp b/include/optional.hpp index 6bc51df..2955d04 100644 --- a/include/optional.hpp +++ b/include/optional.hpp @@ -554,11 +554,15 @@ public: } constexpr T const& value() const { - return initialized() ? contained_val() : atFatal("bad optional access"); + if (!initialized()) + atFatal("bad optional access"); + return contained_val(); } T& value() { - return initialized() ? contained_val() : atFatal("bad optional access"); + if (!initialized()) + atFatal("bad optional access"); + return contained_val(); } # endif