From fbdcabc521aa2fba8ea600e8e45ab26d161b79f3 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 1 Sep 2025 20:14:39 +0200 Subject: [PATCH] bump: Upgrade to tl-expected 1.3.1 --- LICENSE.adoc | 2 +- src/third_party/tl-expected/tl/expected.hpp | 38 ++++++++------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/LICENSE.adoc b/LICENSE.adoc index d75479a0..5bda7c20 100644 --- a/LICENSE.adoc +++ b/LICENSE.adoc @@ -521,7 +521,7 @@ DEALINGS IN THE SOFTWARE. === src/third_party/tl-expected/tl/expected.hpp -This is https://github.com/TartanLlama/expected[TartanLlama expected] 1.2.0 with +This is https://github.com/TartanLlama/expected[TartanLlama expected] 1.3.1 with the following license: ---- diff --git a/src/third_party/tl-expected/tl/expected.hpp b/src/third_party/tl-expected/tl/expected.hpp index 06e6dc4f..59e59aa1 100644 --- a/src/third_party/tl-expected/tl/expected.hpp +++ b/src/third_party/tl-expected/tl/expected.hpp @@ -17,8 +17,8 @@ #define TL_EXPECTED_HPP #define TL_EXPECTED_VERSION_MAJOR 1 -#define TL_EXPECTED_VERSION_MINOR 2 -#define TL_EXPECTED_VERSION_PATCH 0 +#define TL_EXPECTED_VERSION_MINOR 3 +#define TL_EXPECTED_VERSION_PATCH 1 #include #include @@ -51,6 +51,12 @@ #define TL_EXPECTED_GCC55 #endif +#ifdef _MSVC_LANG +#define TL_CPLUSPLUS _MSVC_LANG +#else +#define TL_CPLUSPLUS __cplusplus +#endif + #if !defined(TL_ASSERT) //can't have assert in constexpr in C++11 and GCC 4.9 has a compiler bug #if (TL_CPLUSPLUS > 201103L) && !defined(TL_EXPECTED_GCC49) @@ -109,12 +115,6 @@ struct is_trivially_copy_constructible> : std::false_type {}; std::is_trivially_destructible #endif -#ifdef _MSVC_LANG -#define TL_CPLUSPLUS _MSVC_LANG -#else -#define TL_CPLUSPLUS __cplusplus -#endif - #if TL_CPLUSPLUS > 201103L #define TL_EXPECTED_CXX14 #endif @@ -219,21 +219,13 @@ struct unexpect_t { }; static constexpr unexpect_t unexpect{}; -namespace detail { -template -[[noreturn]] TL_EXPECTED_11_CONSTEXPR void throw_exception(E &&e) { #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED - throw std::forward(e); +#define TL_EXPECTED_THROW_EXCEPTION(e) throw((e)); #else - (void)e; -#ifdef _MSC_VER - __assume(0); -#else - __builtin_unreachable(); -#endif +#define TL_EXPECTED_THROW_EXCEPTION(e) std::terminate(); #endif -} +namespace detail { #ifndef TL_TRAITS_MUTEX #define TL_TRAITS_MUTEX // C++14-style aliases for brevity @@ -2024,28 +2016,28 @@ public: detail::enable_if_t::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR const U &value() const & { if (!has_value()) - detail::throw_exception(bad_expected_access(err().value())); + TL_EXPECTED_THROW_EXCEPTION(bad_expected_access(err().value())); return val(); } template ::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR U &value() & { if (!has_value()) - detail::throw_exception(bad_expected_access(err().value())); + TL_EXPECTED_THROW_EXCEPTION(bad_expected_access(err().value())); return val(); } template ::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR const U &&value() const && { if (!has_value()) - detail::throw_exception(bad_expected_access(std::move(err()).value())); + TL_EXPECTED_THROW_EXCEPTION(bad_expected_access(std::move(err()).value())); return std::move(val()); } template ::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR U &&value() && { if (!has_value()) - detail::throw_exception(bad_expected_access(std::move(err()).value())); + TL_EXPECTED_THROW_EXCEPTION(bad_expected_access(std::move(err()).value())); return std::move(val()); } -- 2.47.3