From f3f3f1b7d94a490b0762db1d1d4040b7d93facdc Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 3 May 2022 02:00:29 -0400 Subject: [PATCH 1/2] hle/result: Add ResultRange overload in ResultVal Also marks the implicit conversion operator as constexpr instead of consteval as the constructor is not constant evaluated. --- src/core/hle/result.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/hle/result.h b/src/core/hle/result.h index 8d38d0030..1a74a7402 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -181,7 +181,7 @@ public: consteval ResultRange(ErrorModule module, u32 description_start, u32 description_end_) : code{module, description_start}, description_end{description_end_} {} - [[nodiscard]] consteval operator ResultCode() const { + [[nodiscard]] constexpr operator ResultCode() const { return code; } @@ -232,6 +232,8 @@ public: constexpr ResultVal(ResultCode code) : expected{Common::Unexpected(code)} {} + constexpr ResultVal(ResultRange range) : expected{Common::Unexpected(range)} {} + template constexpr ResultVal(U&& val) : expected{std::forward(val)} {} From 45591126512f7d6a3f7f3e912df4366bd85157f3 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 3 May 2022 02:18:28 -0400 Subject: [PATCH 2/2] hle/result: Update std::expected replacement message std::expected is included in C++23 --- src/core/hle/result.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/result.h b/src/core/hle/result.h index 1a74a7402..569dd9f38 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -319,7 +319,7 @@ public: } private: - // TODO: Replace this with std::expected once it is standardized in the STL. + // TODO (Morph): Replace this with C++23 std::expected. Common::Expected expected; };