Skip to content

Commit c3f2628

Browse files
Make sure that GCC 13 also compilies with std::expected; resolves #570 (#572)
1 parent 633beb0 commit c3f2628

5 files changed

Lines changed: 21 additions & 14 deletions

File tree

.github/workflows/linux.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ jobs:
3535
- compiler: gcc
3636
compiler-version: 12
3737
cxx: 23
38-
- compiler: gcc
39-
compiler-version: 13
40-
cxx: 23
4138
- compiler: llvm
4239
compiler-version: 16
4340
cxx: 23

.github/workflows/macos.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: ["macos-latest", "macos-13"]
13+
os: ["macos-latest", "macos-15-intel"]
1414
format: ["tests", "benchmarks"]
1515
name: "${{ matrix.os }} (${{ matrix.format }})"
1616
concurrency:

include/rfl/Result.hpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ namespace rfl {
1717
/// Defines the error class to be returned when something went wrong
1818
class Error {
1919
public:
20+
Error() = default;
21+
2022
Error(const std::string& _what) : what_(_what) {}
2123
Error(std::string&& _what) : what_(std::move(_what)) {}
2224

25+
~Error() = default;
26+
2327
Error(const Error& e) = default;
24-
Error(Error&& e) = default;
28+
Error(Error&& e) noexcept = default;
2529

26-
Error& operator=(const Error&) = default;
27-
Error& operator=(Error&&) = default;
30+
Error& operator=(const Error& _other) = default;
31+
32+
Error& operator=(Error&& _other) noexcept = default;
2833

2934
/// Returns the error message, equivalent to .what() in std::exception.
3035
const std::string& what() const& { return what_; }
@@ -450,17 +455,22 @@ template <>
450455
class std::bad_expected_access<rfl::Error> : public bad_expected_access<void> {
451456
public:
452457
explicit constexpr bad_expected_access(rfl::Error er) : err_(std::move(er)) {}
458+
453459
const char* what() const noexcept override { return err_.what().c_str(); }
454460

455-
template <typename Self>
456-
[[nodiscard]]
457-
auto error(this Self&& self) noexcept {
458-
return std::forward<Self>(self).err_;
461+
[[nodiscard]] rfl::Error& error() & noexcept { return err_; }
462+
463+
[[nodiscard]] const rfl::Error& error() const& noexcept { return err_; }
464+
465+
[[nodiscard]] rfl::Error&& error() && noexcept { return std::move(err_); }
466+
467+
[[nodiscard]] const rfl::Error&& error() const&& noexcept {
468+
return std::move(err_);
459469
}
460470

461471
private:
462472
rfl::Error err_;
463473
};
464474
#endif
465475

466-
#endif
476+
#endif

include/rfl/parsing/Parser_unique_ptr.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct Parser<R, W, std::unique_ptr<T>, ProcessorsType> {
4040
}
4141
return Parser<R, W, std::remove_cvref_t<T>, ProcessorsType>::read(_r,
4242
_var)
43-
.transform([](T&& _t) { return std::make_unique<T>(std::move(_t)); });
43+
.transform([](T _t) { return std::make_unique<T>(std::move(_t)); });
4444
}
4545
}
4646

include/rfl/parsing/Parser_variant.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class Parser<R, W, std::variant<AlternativeTypes...>, ProcessorsType> {
224224
if (res) {
225225
_result->emplace(std::move(*res));
226226
} else {
227-
_errors->emplace_back(std::move(res.error()));
227+
_errors->emplace_back(res.error());
228228
}
229229
}
230230
}

0 commit comments

Comments
 (0)