From 57a8670798815cee6edf90c37735da7f49845615 Mon Sep 17 00:00:00 2001 From: le-migou <34062742+le-migou@users.noreply.github.com> Date: Thu, 25 Apr 2019 19:39:03 +0200 Subject: [PATCH] Fix constexpr access to `value()` and `error()` (#53) These accessors call the private helpers `val()` and `err()`, which should also be constexpr. --- tl/expected.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tl/expected.hpp b/tl/expected.hpp index eb88d39..249c24d 100644 --- a/tl/expected.hpp +++ b/tl/expected.hpp @@ -1164,10 +1164,10 @@ class expected : private detail::expected_move_assign_base, template ::value> * = nullptr> - const U &val() const { + constexpr const U &val() const { return this->m_val; } - const unexpected &err() const { return this->m_unexpect; } + constexpr const unexpected &err() const { return this->m_unexpect; } using impl_base = detail::expected_move_assign_base; using ctor_base = detail::expected_default_ctor_base;