From b7e04b7047cb26ad76b0f37525730e10dac914b1 Mon Sep 17 00:00:00 2001 From: Giel van Schijndel Date: Wed, 24 Oct 2018 20:42:29 +0200 Subject: [PATCH] Fix compile errors detected by Clang --- expected.hpp | 14 +++++++------- monads.hpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/expected.hpp b/expected.hpp index 73f9f16..874f467 100644 --- a/expected.hpp +++ b/expected.hpp @@ -606,28 +606,28 @@ namespace util constexpr const T& value() const& { if (!has_value()) - throw std::logic_error(); + throw std::logic_error("precondition error: doesn't have value"); return **this; } constexpr T& value() & { if (!has_value()) - throw std::logic_error(); + throw std::logic_error("precondition error: doesn't have value"); return **this; } constexpr const T&& value() const&& { if (!has_value()) - throw std::logic_error(); + throw std::logic_error("precondition error: doesn't have value"); return *std::move(*this); } constexpr T&& value() && { if (!has_value()) - throw std::logic_error(); + throw std::logic_error("precondition error: doesn't have value"); return *std::move(*this); } @@ -658,7 +658,7 @@ namespace util template constexpr T value_or(U&& v) const& { - if (has_value) + if (has_value()) return **this; else return static_cast(std::forward(v)); @@ -667,7 +667,7 @@ namespace util template constexpr T value_or(U&& v) && { - if (has_value) + if (has_value()) return std::move(**this); else return static_cast(std::forward(v)); @@ -930,7 +930,7 @@ namespace util constexpr void value() const { if (!has_value()) - throw std::logic_error(); + throw std::logic_error("precondition error: doesn't have value"); } constexpr const E& error() const& diff --git a/monads.hpp b/monads.hpp index 928f401..fd62580 100644 --- a/monads.hpp +++ b/monads.hpp @@ -67,7 +67,7 @@ namespace monad } template - constexpr std::error_code get_error(T&& v, Ts&&... vs) noexcept + std::error_code get_error(T&& v, Ts&&... vs) noexcept { if constexpr (is_monad_v>) if (!has_value(v))