From 305db8a382be245cc357a8edd686e951f97e1854 Mon Sep 17 00:00:00 2001 From: Simon Brand Date: Thu, 2 Nov 2017 08:59:35 +0000 Subject: [PATCH] Fix GCC4.9 --- expected.hpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/expected.hpp b/expected.hpp index b0361bb..5430e0d 100644 --- a/expected.hpp +++ b/expected.hpp @@ -419,8 +419,7 @@ struct expected_operations_base : expected_storage_base { template ::value> * = nullptr> - void - assign(const expected_operations_base &rhs) noexcept { + void assign(const expected_operations_base &rhs) noexcept { if (!this->m_has_val && rhs.m_has_val) { geterr().~unexpected(); construct(rhs.get()); @@ -435,8 +434,7 @@ struct expected_operations_base : expected_storage_base { detail::enable_if_t::value && std::is_nothrow_move_constructible::value> * = nullptr> - void - assign(const expected_operations_base &rhs) noexcept { + void assign(const expected_operations_base &rhs) noexcept { if (!this->m_has_val && rhs.m_has_val) { T tmp = rhs.get(); geterr().~unexpected(); @@ -1143,8 +1141,8 @@ public: constexpr expected() = default; constexpr expected(const expected &rhs) = default; constexpr expected(expected &&rhs) = default; - constexpr expected &operator=(const expected &rhs) = default; - constexpr expected &operator=(expected &&rhs) = default; + expected &operator=(const expected &rhs) = default; + expected &operator=(expected &&rhs) = default; template ::value> * = @@ -1223,7 +1221,7 @@ public: detail::enable_if_t::value && std::is_convertible::value)> * = nullptr> - explicit constexpr expected(const expected &rhs) + explicit TL_EXPECTED_11_CONSTEXPR expected(const expected &rhs) : ctor_base(detail::default_constructor_tag{}) { if (rhs.has_value()) { ::new (valptr()) T(*rhs); @@ -1238,7 +1236,7 @@ public: detail::enable_if_t<(std::is_convertible::value && std::is_convertible::value)> * = nullptr> - constexpr expected(const expected &rhs) + TL_EXPECTED_11_CONSTEXPR expected(const expected &rhs) : ctor_base(detail::default_constructor_tag{}) { if (rhs.has_value()) { ::new (valptr()) T(*rhs); @@ -1252,7 +1250,7 @@ public: class U, class G, detail::enable_if_t::value && std::is_convertible::value)> * = nullptr> - explicit constexpr expected(expected &&rhs) + explicit TL_EXPECTED_11_CONSTEXPR expected(expected &&rhs) : ctor_base(detail::default_constructor_tag{}) { if (rhs.has_value()) { ::new (valptr()) T(std::move(*rhs)); @@ -1267,7 +1265,7 @@ public: class U, class G, detail::enable_if_t<(std::is_convertible::value && std::is_convertible::value)> * = nullptr> - constexpr expected(expected &&rhs) + TL_EXPECTED_11_CONSTEXPR expected(expected &&rhs) : ctor_base(detail::default_constructor_tag{}) { if (rhs.has_value()) { ::new (valptr()) T(std::move(*rhs)); @@ -1464,11 +1462,11 @@ public: } constexpr const T *operator->() const { return valptr(); } - constexpr T *operator->() { return valptr(); } + TL_EXPECTED_11_CONSTEXPR T *operator->() { return valptr(); } constexpr const T &operator*() const & { return val(); } - constexpr T &operator*() & { return val(); } + TL_EXPECTED_11_CONSTEXPR T &operator*() & { return val(); } constexpr const T &&operator*() const && { return std::move(val()); } - constexpr T &&operator*() && { return std::move(val()); } + TL_EXPECTED_11_CONSTEXPR T &&operator*() && { return std::move(val()); } constexpr explicit operator bool() const noexcept { return this->m_has_val; } constexpr bool has_value() const noexcept { return this->m_has_val; } constexpr const T &value() const & { @@ -1476,7 +1474,7 @@ public: throw bad_expected_access(err()); return val(); } - constexpr T &value() & { + TL_EXPECTED_11_CONSTEXPR T &value() & { if (!has_value()) throw bad_expected_access(err()); return val(); @@ -1486,22 +1484,22 @@ public: throw bad_expected_access(err()); return std::move(val()); } - constexpr T &&value() && { + TL_EXPECTED_11_CONSTEXPR T &&value() && { if (!has_value()) throw bad_expected_access(err()); return std::move(val()); } constexpr const E &error() const & { return err().value(); } - constexpr E &error() & { return err().value(); } + TL_EXPECTED_11_CONSTEXPR E &error() & { return err().value(); } constexpr const E &&error() const && { return std::move(err().value()); } - constexpr E &&error() && { return std::move(err().value()); } + TL_EXPECTED_11_CONSTEXPR E &&error() && { return std::move(err().value()); } template constexpr T value_or(U &&v) const & { static_assert(std::is_copy_constructible::value && std::is_convertible::value, "T must be copy-constructible and convertible to from U&&"); return bool(*this) ? **this : static_cast(std::forward(v)); } - template T value_or(U &&v) && { + template TL_EXPECTED_11_CONSTEXPR T value_or(U &&v) && { static_assert(std::is_move_constructible::value && std::is_convertible::value, "T must be move-constructible and convertible to from U&&");