From ae449c64690525b53af8b423148fd26845ad2e7c Mon Sep 17 00:00:00 2001 From: Simon Brand Date: Thu, 2 Nov 2017 08:33:28 +0000 Subject: [PATCH] Fix build on clang --- expected.hpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/expected.hpp b/expected.hpp index 145af04..b0361bb 100644 --- a/expected.hpp +++ b/expected.hpp @@ -419,7 +419,7 @@ struct expected_operations_base : expected_storage_base { template ::value> * = nullptr> - expected_operations_base & + void assign(const expected_operations_base &rhs) noexcept { if (!this->m_has_val && rhs.m_has_val) { geterr().~unexpected(); @@ -435,7 +435,7 @@ struct expected_operations_base : expected_storage_base { detail::enable_if_t::value && std::is_nothrow_move_constructible::value> * = nullptr> - expected_operations_base & + void assign(const expected_operations_base &rhs) noexcept { if (!this->m_has_val && rhs.m_has_val) { T tmp = rhs.get(); @@ -455,7 +455,7 @@ struct expected_operations_base : expected_storage_base { detail::enable_if_t::value && !std::is_nothrow_move_constructible::value> * = nullptr> - expected_operations_base &assign(const expected_operations_base &rhs) { + void assign(const expected_operations_base &rhs) { if (!this->m_has_val && rhs.m_has_val) { auto tmp = std::move(geterr()); geterr().~unexpected(); @@ -475,7 +475,7 @@ struct expected_operations_base : expected_storage_base { template ::value> * = nullptr> - expected_operations_base &assign(expected_operations_base &&rhs) noexcept { + void assign(expected_operations_base &&rhs) noexcept { if (!this->m_has_val && rhs.m_has_val) { geterr().~unexpected(); construct(std::move(rhs).get()); @@ -487,7 +487,7 @@ struct expected_operations_base : expected_storage_base { template ::value> * = nullptr> - expected_operations_base &assign(expected_operations_base &&rhs) { + void assign(expected_operations_base &&rhs) { if (!this->m_has_val && rhs.m_has_val) { auto tmp = std::move(geterr()); geterr().~unexpected(); @@ -509,7 +509,7 @@ struct expected_operations_base : expected_storage_base { get() = std::forward(rhs).get(); } else { get().~T(); - construct_err(std::forward(rhs).geterr()); + construct_error(std::forward(rhs).geterr()); } } else { if (!rhs.m_has_val) { @@ -527,11 +527,17 @@ struct expected_operations_base : expected_storage_base { constexpr const T &&get() const && { return std::move(this->m_val); } #endif - TL_EXPECTED_11_CONSTEXPR unexpected &geterr() & { return this->m_unexpect; } + TL_EXPECTED_11_CONSTEXPR unexpected &geterr() & { + return this->m_unexpect; + } constexpr const unexpected &geterr() const & { return this->m_unexpect; } - TL_EXPECTED_11_CONSTEXPR unexpected &&geterr() && { std::move(this->m_unexpect); } + TL_EXPECTED_11_CONSTEXPR unexpected &&geterr() && { + std::move(this->m_unexpect); + } #ifndef TL_EXPECTED_NO_CONSTRR - constexpr const unexpected &&geterr() const && { return std::move(this->m_unexpect); } + constexpr const unexpected &&geterr() const && { + return std::move(this->m_unexpect); + } #endif }; @@ -613,6 +619,7 @@ struct expected_copy_assign_base : expected_move_base { expected_copy_assign_base(expected_copy_assign_base &&rhs) = default; expected_copy_assign_base &operator=(const expected_copy_assign_base &rhs) { this->assign(rhs); + return *this; } expected_copy_assign_base & operator=(expected_copy_assign_base &&rhs) = default; @@ -649,6 +656,7 @@ struct expected_move_assign_base std::is_nothrow_move_constructible::value &&std::is_nothrow_move_assignable::value) { this->assign(std::move(rhs)); + return *this; } expected_move_assign_base & operator=(expected_move_assign_base &&rhs) = default;