Skip to content

Commit

Permalink
Fix compile errors detected by Clang
Browse files Browse the repository at this point in the history
  • Loading branch information
muggenhor committed Oct 24, 2018
1 parent 35991b4 commit b7e04b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions expected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -658,7 +658,7 @@ namespace util
template <typename U>
constexpr T value_or(U&& v) const&
{
if (has_value)
if (has_value())
return **this;
else
return static_cast<T>(std::forward<U>(v));
Expand All @@ -667,7 +667,7 @@ namespace util
template <typename U>
constexpr T value_or(U&& v) &&
{
if (has_value)
if (has_value())
return std::move(**this);
else
return static_cast<T>(std::forward<U>(v));
Expand Down Expand Up @@ -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&
Expand Down
2 changes: 1 addition & 1 deletion monads.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace monad
}

template <typename T, typename... Ts>
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<std::decay_t<T>>)
if (!has_value(v))
Expand Down

0 comments on commit b7e04b7

Please sign in to comment.