From 2e2ec78ff80cfc1cf9c850fdda97b04e7a69eeea Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 11 Jan 2026 13:29:45 +0100 Subject: [PATCH 1/4] Adapt the code so that C++-23 works with GCC 13 --- include/rfl/Result.hpp | 19 ++++++++++++------- include/rfl/parsing/Parser_unique_ptr.hpp | 2 +- include/rfl/parsing/Parser_variant.hpp | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/include/rfl/Result.hpp b/include/rfl/Result.hpp index 12a8b689..8f7536f4 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& _other) = default; - Error& operator=(const Error&) = default; - Error& operator=(Error&&) = 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,12 @@ 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_; + auto error() const noexcept { + return err_; } private: @@ -463,4 +468,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()); } } } From 3e447a575e516e75a43bdf958e498ad0a645e76d Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 11 Jan 2026 13:30:00 +0100 Subject: [PATCH 2/4] Added C++23 GCC 13 to the testing pipeline --- .github/workflows/linux.yaml | 3 --- 1 file changed, 3 deletions(-) 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 From 831c8a1ba1b231bc528e36df5cbb7b6bbe27d3de Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 11 Jan 2026 13:41:11 +0100 Subject: [PATCH 3/4] Better handling of the errors --- include/rfl/Result.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/rfl/Result.hpp b/include/rfl/Result.hpp index 8f7536f4..3eda7a4f 100644 --- a/include/rfl/Result.hpp +++ b/include/rfl/Result.hpp @@ -458,9 +458,14 @@ class std::bad_expected_access : public bad_expected_access { const char* what() const noexcept override { return err_.what().c_str(); } - [[nodiscard]] - auto error() const noexcept { - return 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: From fb96c67d5b0d58de4e1422e93c211fe4d261466d Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 11 Jan 2026 13:58:15 +0100 Subject: [PATCH 4/4] Run on macos 15 intel instead --- .github/workflows/macos.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: