diff --git a/.github/actions/setup-vcpkg/action.yml b/.github/actions/setup-vcpkg/action.yml index 65292cb28..9276c7997 100644 --- a/.github/actions/setup-vcpkg/action.yml +++ b/.github/actions/setup-vcpkg/action.yml @@ -27,6 +27,26 @@ runs: echo "vcpkg-revision=$(git rev-parse HEAD:vcpkg)" >> "$GITHUB_OUTPUT" echo "image-version=${ImageVersion:-unknown}" >> "$GITHUB_OUTPUT" + # Windows ships CMake 4.x (C:/Program Files/CMake), whose stricter source_group + # aborts Boost.Locale's configure step. run-vcpkg always invokes CMake at that + # fixed path and ignores the PATH, so the only reliable fix is to overwrite the + # system cmake.exe with the pinned 3.x (the same effect the pip fix achieves on macOS). + - name: Install pinned CMake 3.x on Windows + if: runner.os == 'Windows' + shell: powershell + run: | + # Install without --target: the wheel's cmake.exe is a Python launcher that + # imports the cmake package, so it only works once both are importable. + python -m pip install "cmake==3.26.4" + $packages = & python -c "import sysconfig; print(sysconfig.get_paths()['purelib'])" + # Locate the real cmake.exe inside the wheel (the launcher lives in Scripts/, + # outside site-packages, so restrict the search to the package itself). + $real = Get-ChildItem -Path (Join-Path $packages 'cmake') -Filter cmake.exe -Recurse | + Select-Object -First 1 + if (-NOT $real) { throw "could not locate cmake.exe in the pip package" } + Copy-Item $real.FullName "C:\Program Files\CMake\bin\cmake.exe" -Force + cmake --version + # run-vcpkg requires binaryCachePath to exist before the action starts. - uses: lukka/run-vcpkg@v11 with: diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 2f5fba43e..ef826164f 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -28,6 +28,14 @@ jobs: run: brew install bison openssl@3 - name: Install ninja run: brew install ninja + - name: Install CMake 3.x (system CMake 4 breaks Boost.Locale's source_group) + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install pinned CMake into the Python environment + run: | + python -m pip install "cmake==3.26.4" + cmake --version - name: Compile env: CC: clang diff --git a/include/rfl/internal/cpp20/Result.hpp b/include/rfl/internal/cpp20/Result.hpp index 6d516e4f0..fb436bedb 100644 --- a/include/rfl/internal/cpp20/Result.hpp +++ b/include/rfl/internal/cpp20/Result.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "../Error.hpp" #include "../always_inline.hpp" @@ -334,7 +335,7 @@ class Result { template RFL_ALWAYS_INLINE auto transform(const F& _f) && { /// Result_U is expected to be of type Result. - using U = std::invoke_result_t; + using U = decltype(std::declval()(std::declval())); if (success_) { return Result(_f(std::move(*this).get_t())); } else { @@ -549,9 +550,10 @@ class Result { * original value. */ template - Result transform_error(F&& f) && { - static_assert(std::is_same, Error>(), - "A function passed to transform_error must return an error."); + Result transform_error(F&& f) && { + static_assert( + std::is_same()(std::declval())), Error>(), + "A function passed to transform_error must return an error."); if (!has_value()) { return Result{std::invoke(f, std::move(*this).get_err())}; } else { @@ -577,9 +579,10 @@ class Result { * original value. */ template - Result transform_error(F&& f) const& { - static_assert(std::is_same, Error>(), - "A function passed to transform_error must return an error."); + Result transform_error(F&& f) const& { + static_assert( + std::is_same()(std::declval())), Error>(), + "A function passed to transform_error must return an error."); if (!has_value()) { return Result{std::invoke(f, get_err())}; } else { diff --git a/include/rfl/internal/nth_element_t.hpp b/include/rfl/internal/nth_element_t.hpp index 016a121fa..04719b588 100644 --- a/include/rfl/internal/nth_element_t.hpp +++ b/include/rfl/internal/nth_element_t.hpp @@ -1,6 +1,8 @@ #ifndef RFL_INTERNAL_NTH_ELEMENT_T_HPP_ #define RFL_INTERNAL_NTH_ELEMENT_T_HPP_ +#include + #include "nth_element.hpp" namespace rfl::internal { @@ -19,8 +21,8 @@ struct TypeWrapper { template using nth_element_t = - typename std::invoke_result_t...>), - TypeWrapper...>::Type; + decltype(nth_element...>( + std::declval>()...))::Type; #endif diff --git a/include/rfl/internal/processed_t.hpp b/include/rfl/internal/processed_t.hpp index 1e6250c5d..a2aee34cc 100644 --- a/include/rfl/internal/processed_t.hpp +++ b/include/rfl/internal/processed_t.hpp @@ -2,6 +2,7 @@ #define RFL_INTERNAL_PROCESSED_T_HPP_ #include +#include #include "../Processors.hpp" #include "ptr_named_tuple_t.hpp" @@ -16,9 +17,8 @@ template struct Processed> { using PtrNamedTupleType = ptr_named_tuple_t; using type = typename remove_ptrs_nt< - std::invoke_result_t::template process< - StructType, PtrNamedTupleType>), - PtrNamedTupleType>>::NamedTupleType; + decltype(Processors::template process( + std::declval()))>::NamedTupleType; }; template diff --git a/include/rfl/internal/ptr_named_tuple_t.hpp b/include/rfl/internal/ptr_named_tuple_t.hpp index e1b958084..626f79dc9 100644 --- a/include/rfl/internal/ptr_named_tuple_t.hpp +++ b/include/rfl/internal/ptr_named_tuple_t.hpp @@ -2,6 +2,7 @@ #define RFL_INTERNAL_PTR_FIELD_TUPLE_T_HPP_ #include +#include #include "to_ptr_named_tuple.hpp" @@ -9,7 +10,7 @@ namespace rfl::internal { template using ptr_named_tuple_t = - std::invoke_result_t), T>; + decltype(to_ptr_named_tuple(std::declval())); } // namespace rfl::internal diff --git a/include/rfl/internal/tag_t.hpp b/include/rfl/internal/tag_t.hpp index 4ce5e0d1d..bc0bf7d08 100644 --- a/include/rfl/internal/tag_t.hpp +++ b/include/rfl/internal/tag_t.hpp @@ -2,6 +2,7 @@ #define RFL_INTERNAL_TAG_T_HPP_ #include +#include #include "StringLiteral.hpp" #include "make_tag.hpp" @@ -9,7 +10,7 @@ namespace rfl::internal { template -using tag_t = std::invoke_result_t), T>; +using tag_t = decltype(make_tag<_discriminator, T>(std::declval())); } // namespace rfl::internal diff --git a/include/rfl/internal/variant/result_t.hpp b/include/rfl/internal/variant/result_t.hpp index a906c5af1..78af725b6 100644 --- a/include/rfl/internal/variant/result_t.hpp +++ b/include/rfl/internal/variant/result_t.hpp @@ -2,14 +2,16 @@ #define RFL_INTERNAL_VARIANT_RESULT_T_HPP_ #include +#include #include "../nth_element_t.hpp" namespace rfl::internal::variant { template -using result_t = std::remove_cv_t, internal::nth_element_t<0, AlternativeTypes...>&>>; +using result_t = std::remove_cv_t>()( + std::declval&>()))>; } // namespace rfl::internal::variant diff --git a/include/rfl/parsing/ParserTaggedUnion.hpp b/include/rfl/parsing/ParserTaggedUnion.hpp index 0e9c6dc81..dee232752 100644 --- a/include/rfl/parsing/ParserTaggedUnion.hpp +++ b/include/rfl/parsing/ParserTaggedUnion.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "../Result.hpp" #include "../TaggedUnion.hpp" @@ -128,8 +129,9 @@ struct ParserTaggedUnion, return Parser, ProcessorsType>::to_schema(_definitions); } else { - using VariantType = std::variant), AlternativeTypes>...>; + using VariantType = std::variant(std::declval())) + ...>; return Parser::to_schema(_definitions); } } @@ -191,8 +193,9 @@ struct ParserTaggedUnion, return wrap_error(stream.str(), std::move(_e)); }; - using T = tagged_union_wrapper_no_ptr_t), AlternativeType>>; + using T = tagged_union_wrapper_no_ptr_t(std::declval() + ))>; *_result = Parser::read(_r, _var) .transform(get_fields) diff --git a/include/rfl/parsing/VariantAlternativeWrapper.hpp b/include/rfl/parsing/VariantAlternativeWrapper.hpp index 208589c27..029afc456 100644 --- a/include/rfl/parsing/VariantAlternativeWrapper.hpp +++ b/include/rfl/parsing/VariantAlternativeWrapper.hpp @@ -2,6 +2,7 @@ #define RFL_PARSING_VARIANTALTERNATIVEWRAPPER_HPP_ #include +#include #include "../Field.hpp" #include "../Literal.hpp" @@ -44,8 +45,8 @@ consteval auto make_tag() { } template -using tag_t = std::invoke_result_t< - decltype(make_tag>, _remove_namespaces>)>; +using tag_t = decltype(make_tag>, + _remove_namespaces>()); } // namespace vaw diff --git a/include/rfl/view_t.hpp b/include/rfl/view_t.hpp index c1c7569df..0896c1018 100644 --- a/include/rfl/view_t.hpp +++ b/include/rfl/view_t.hpp @@ -2,6 +2,7 @@ #define RFL_VIEW_T_HPP_ #include +#include #include "Processors.hpp" #include "internal/ptr_named_tuple_t.hpp" @@ -10,10 +11,9 @@ namespace rfl { /// Generates the named tuple that would be the result of to_view template -using view_t = - std::invoke_result_t::template process< - T, internal::ptr_named_tuple_t>), - internal::ptr_named_tuple_t>; +using view_t = decltype(Processors::template process< + T, internal::ptr_named_tuple_t>( + std::declval>())); } // namespace rfl diff --git a/vcpkg b/vcpkg index 0e5030f58..93ad765c7 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 0e5030f583a5427123cd3b714255e5ae62faa3ba +Subproject commit 93ad765c7b66ab9ce97469ec23a90b15c3a14ee5