diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 38d322a..ae00544 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: # This brings in a portable version of clang-format. # See also: https://github.com/ssciwr/clang-format-wheel - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v22.1.8 + rev: v23.1.3 hooks: - id: clang-format types_or: [c++, c] @@ -23,7 +23,7 @@ repos: # CMake linting and formatting - repo: https://github.com/BlankSpruce/gersemi-pre-commit - rev: 0.28.0 + rev: 0.29.2 hooks: - id: gersemi name: CMake linting diff --git a/include/beman/expected/expected.hpp b/include/beman/expected/expected.hpp index 3222a10..d1bfdbb 100644 --- a/include/beman/expected/expected.hpp +++ b/include/beman/expected/expected.hpp @@ -208,9 +208,9 @@ class expected { std::is_constructible_v && (std::is_same_v> || !detail::converts_from_any_cvref>) && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr explicit(!std::is_convertible_v || !std::is_convertible_v) expected(const expected& rhs); @@ -219,9 +219,9 @@ class expected { requires(!std::is_reference_v && std::is_constructible_v && std::is_constructible_v && (std::is_same_v> || !detail::converts_from_any_cvref>) && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr explicit(!std::is_convertible_v || !std::is_convertible_v) expected(expected&& rhs); // Converting constructor from expected — reference-E path: only accepts sources @@ -233,7 +233,7 @@ class expected { expected(const expected& rhs); template - requires(std::is_reference_v && std::is_reference_v && std::is_constructible_v && + requires(std::is_reference_v && std::is_reference_v && std::is_constructible_v && std::is_convertible_v) constexpr explicit(!std::is_convertible_v || !std::is_convertible_v) expected(expected&& rhs); @@ -714,9 +714,9 @@ template requires(!std::is_reference_v && std::is_constructible_v && std::is_constructible_v && (std::is_same_v> || !detail::converts_from_any_cvref>) && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr expected::expected(const expected& rhs) : has_val_(rhs.has_value()) { if (has_val_) std::construct_at(std::addressof(val_), *rhs); @@ -730,9 +730,9 @@ template requires(!std::is_reference_v && std::is_constructible_v && std::is_constructible_v && (std::is_same_v> || !detail::converts_from_any_cvref>) && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr expected::expected(expected&& rhs) : has_val_(rhs.has_value()) { if (has_val_) std::construct_at(std::addressof(val_), *std::move(rhs)); @@ -766,7 +766,7 @@ constexpr expected::expected(const expected& rhs) : has_val_(rhs.has //! \also cvt-copy-ctor-ref template template - requires(std::is_reference_v && std::is_reference_v && std::is_constructible_v && + requires(std::is_reference_v && std::is_reference_v && std::is_constructible_v && std::is_convertible_v) constexpr expected::expected(expected&& rhs) : has_val_(rhs.has_value()) { if (has_val_) @@ -1879,17 +1879,17 @@ class expected { template requires(std::is_void_v && !std::is_reference_v && !std::is_same_v && std::is_constructible_v && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr explicit(!std::is_convertible_v) expected(const expected& rhs); template requires(std::is_void_v && !std::is_reference_v && !std::is_same_v && std::is_constructible_v && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr explicit(!std::is_convertible_v) expected(expected&& rhs); // Constructor from unexpected const& / && — value-E path @@ -2281,9 +2281,9 @@ template template requires(std::is_void_v && !std::is_reference_v && !std::is_same_v && std::is_constructible_v && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr expected::expected(const expected& rhs) : has_val_(rhs.has_value()) { if (!has_val_) std::construct_at(std::addressof(unex_), rhs.error()); @@ -2294,9 +2294,9 @@ template template requires(std::is_void_v && !std::is_reference_v && !std::is_same_v && std::is_constructible_v && !std::is_constructible_v, expected&> && - !std::is_constructible_v, expected &&> && + !std::is_constructible_v, expected&&> && !std::is_constructible_v, const expected&> && - !std::is_constructible_v, const expected &&>) + !std::is_constructible_v, const expected&&>) constexpr expected::expected(expected&& rhs) : has_val_(rhs.has_value()) { if (!has_val_) std::construct_at(std::addressof(unex_), std::move(rhs).error()); diff --git a/include/beman/expected/unexpected.hpp b/include/beman/expected/unexpected.hpp index 3c17277..70968bf 100644 --- a/include/beman/expected/unexpected.hpp +++ b/include/beman/expected/unexpected.hpp @@ -236,7 +236,7 @@ class unexpected { //! would bind `E&` to a temporary — is defined as deleted. template requires(!std::is_same_v, unexpected> && - !std::is_same_v, std::in_place_t> && std::is_constructible_v && + !std::is_same_v, std::in_place_t> && std::is_constructible_v && !detail::reference_constructs_from_temporary_v) constexpr explicit unexpected(G&& e) noexcept : ptr_(std::addressof(static_cast(std::forward(e)))) {} @@ -253,7 +253,7 @@ class unexpected { //! \merge template requires(!std::is_same_v, unexpected> && - !std::is_same_v, std::in_place_t> && !std::is_constructible_v && + !std::is_same_v, std::in_place_t> && !std::is_constructible_v && !detail::reference_constructs_from_temporary_v) constexpr unexpected(G&&) = BEMAN_EXPECTED_DELETE_MSG("unexpected: no viable conversion from the given argument to E&"); @@ -268,7 +268,7 @@ class unexpected { //! \effects Initializes `unex` with //! `addressof(static_cast(std::forward(e)))`. template - requires(std::is_constructible_v && !detail::reference_constructs_from_temporary_v) + requires(std::is_constructible_v && !detail::reference_constructs_from_temporary_v) constexpr explicit unexpected(std::in_place_t, G&& e) noexcept : ptr_(std::addressof(static_cast(std::forward(e)))) {}