From 1415eb4cb5af32ebdfb9fd8cb0c52f1ca0e5d2c8 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 28 Apr 2025 22:02:57 +0200 Subject: [PATCH 1/3] :construction_worker: build ci_module_cpp20 with MSVC Signed-off-by: Niels Lohmann --- .github/workflows/windows.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 124b089d7e..cf0833b10f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -111,3 +111,11 @@ jobs: run: cmake --build build --config Debug --parallel 10 - name: Test run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure + + ci_module_cpp20: + runs-on: windows-latest + steps: + - name: Run CMake (Debug) + run: cmake -S . -B build -G "Visual Studio 17 2022" -DJSON_CI=ON -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX" + - name: Build + run: cmake --build build --config Debug --target ci_module_cpp20 From c17c7a8bd8a32a8876501169727dd790231619bc Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 28 Apr 2025 23:03:35 +0200 Subject: [PATCH 2/3] :construction_worker: build ci_module_cpp20 with MSVC Signed-off-by: Niels Lohmann --- .github/workflows/windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index cf0833b10f..c4b97cc5d4 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -115,6 +115,7 @@ jobs: ci_module_cpp20: runs-on: windows-latest steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Run CMake (Debug) run: cmake -S . -B build -G "Visual Studio 17 2022" -DJSON_CI=ON -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX" - name: Build From 41c94e06fc0aa0d25e16f84b2d928c1b4f0259c6 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 28 Apr 2025 23:18:35 +0200 Subject: [PATCH 3/3] :construction_worker: build ci_module_cpp20 with MSVC Signed-off-by: Niels Lohmann --- include/nlohmann/json.hpp | 1 + single_include/nlohmann/json.hpp | 2 ++ tests/src/unit-msgpack.cpp | 14 ++++++++------ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index ed51cd5447..2e0b6882df 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 850cd8ebf3..125520b058 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -12889,6 +12889,8 @@ NLOHMANN_JSON_NAMESPACE_END // #include +// #include + // #include // #include diff --git a/tests/src/unit-msgpack.cpp b/tests/src/unit-msgpack.cpp index bfea2dce1f..2a841d0f98 100644 --- a/tests/src/unit-msgpack.cpp +++ b/tests/src/unit-msgpack.cpp @@ -1914,10 +1914,12 @@ TEST_CASE("MessagePack with std::byte") SECTION("empty vector") { const std::vector empty_data; - CHECK_THROWS_WITH_AS([&]() { - [[maybe_unused]] auto result = json::from_msgpack(empty_data); - return true; - }(), + CHECK_THROWS_WITH_AS([&]() + { + [[maybe_unused]] auto result = json::from_msgpack(empty_data); + return true; + } + (), "[json.exception.parse_error.110] parse error at byte 1: syntax error while parsing MessagePack value: unexpected end of input", json::parse_error&); } @@ -1946,8 +1948,8 @@ TEST_CASE("MessagePack with std::byte") json direct_result = json::from_msgpack(msgpack_data); // Test the workaround approach: reinterpret as unsigned char* and use iterator range - const auto *const char_start = reinterpret_cast(msgpack_data.data()); - const auto *const char_end = char_start + msgpack_data.size(); + const auto* const char_start = reinterpret_cast(msgpack_data.data()); + const auto* const char_end = char_start + msgpack_data.size(); json workaround_result = json::from_msgpack(char_start, char_end); // Verify that the final deserialized JSON matches the original JSON