diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 33f77c9a..a367e8f6 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -35,9 +35,6 @@ jobs: - compiler: gcc compiler-version: 12 cxx: 23 - - compiler: gcc - compiler-version: 13 - cxx: 23 - compiler: llvm compiler-version: 16 cxx: 23 diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 6365a95c..a6a59bf7 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["macos-latest", "macos-13"] + os: ["macos-latest", "macos-15-intel"] format: ["tests", "benchmarks"] name: "${{ matrix.os }} (${{ matrix.format }})" concurrency: diff --git a/include/rfl/Result.hpp b/include/rfl/Result.hpp index 12a8b689..3eda7a4f 100644 --- a/include/rfl/Result.hpp +++ b/include/rfl/Result.hpp @@ -17,14 +17,19 @@ namespace rfl { /// Defines the error class to be returned when something went wrong class Error { public: + Error() = default; + Error(const std::string& _what) : what_(_what) {} Error(std::string&& _what) : what_(std::move(_what)) {} + ~Error() = default; + Error(const Error& e) = default; - Error(Error&& e) = default; + Error(Error&& e) noexcept = default; - Error& operator=(const Error&) = default; - Error& operator=(Error&&) = default; + Error& operator=(const Error& _other) = default; + + Error& operator=(Error&& _other) noexcept = default; /// Returns the error message, equivalent to .what() in std::exception. const std::string& what() const& { return what_; } @@ -450,12 +455,17 @@ template <> class std::bad_expected_access : public bad_expected_access { public: explicit constexpr bad_expected_access(rfl::Error er) : err_(std::move(er)) {} + const char* what() const noexcept override { return err_.what().c_str(); } - template - [[nodiscard]] - auto error(this Self&& self) noexcept { - return std::forward(self).err_; + [[nodiscard]] rfl::Error& error() & noexcept { return err_; } + + [[nodiscard]] const rfl::Error& error() const& noexcept { return err_; } + + [[nodiscard]] rfl::Error&& error() && noexcept { return std::move(err_); } + + [[nodiscard]] const rfl::Error&& error() const&& noexcept { + return std::move(err_); } private: @@ -463,4 +473,4 @@ class std::bad_expected_access : public bad_expected_access { }; #endif -#endif \ No newline at end of file +#endif diff --git a/include/rfl/parsing/Parser_unique_ptr.hpp b/include/rfl/parsing/Parser_unique_ptr.hpp index 344fdb3d..7c26a464 100644 --- a/include/rfl/parsing/Parser_unique_ptr.hpp +++ b/include/rfl/parsing/Parser_unique_ptr.hpp @@ -40,7 +40,7 @@ struct Parser, ProcessorsType> { } return Parser, ProcessorsType>::read(_r, _var) - .transform([](T&& _t) { return std::make_unique(std::move(_t)); }); + .transform([](T _t) { return std::make_unique(std::move(_t)); }); } } diff --git a/include/rfl/parsing/Parser_variant.hpp b/include/rfl/parsing/Parser_variant.hpp index 2bfa3e87..55b1da69 100644 --- a/include/rfl/parsing/Parser_variant.hpp +++ b/include/rfl/parsing/Parser_variant.hpp @@ -224,7 +224,7 @@ class Parser, ProcessorsType> { if (res) { _result->emplace(std::move(*res)); } else { - _errors->emplace_back(std::move(res.error())); + _errors->emplace_back(res.error()); } } }