Skip to content

Commit

Permalink
Resolve result ctor ambiguity
Browse files Browse the repository at this point in the history
This showed up with ok(nullptr) when both R and E could accept nullptrs.
  • Loading branch information
jeaye committed Mar 16, 2024
1 parent 8eaf01a commit 5fd1770
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/cpp/jank/result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ namespace jank
template <typename T>
constexpr result(detail::result<true, T> const &t,
std::enable_if_t<std::is_constructible_v<R, T>> * = nullptr)
: data{ t.data }
: data{ R{ t.data } }
{
}

template <typename T>
constexpr result(detail::result<false, T> const &t,
std::enable_if_t<std::is_constructible_v<E, T>> * = nullptr)
: data{ t.data }
: data{ E{ t.data } }
{
}

Expand Down

0 comments on commit 5fd1770

Please sign in to comment.