Fix constexpr access to value() and error() (#53)

These accessors call the private helpers `val()` and `err()`, which
should also be constexpr.
This commit is contained in:
le-migou
2019-04-25 19:39:03 +02:00
committed by Simon Brand
parent 199b5267fe
commit 57a8670798

View File

@@ -1164,10 +1164,10 @@ class expected : private detail::expected_move_assign_base<T, E>,
template <class U = T, template <class U = T,
detail::enable_if_t<!std::is_void<U>::value> * = nullptr> detail::enable_if_t<!std::is_void<U>::value> * = nullptr>
const U &val() const { constexpr const U &val() const {
return this->m_val; return this->m_val;
} }
const unexpected<E> &err() const { return this->m_unexpect; } constexpr const unexpected<E> &err() const { return this->m_unexpect; }
using impl_base = detail::expected_move_assign_base<T, E>; using impl_base = detail::expected_move_assign_base<T, E>;
using ctor_base = detail::expected_default_ctor_base<T, E>; using ctor_base = detail::expected_default_ctor_base<T, E>;