From 41c94e06fc0aa0d25e16f84b2d928c1b4f0259c6 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 28 Apr 2025 23:18:35 +0200 Subject: [PATCH] :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 ed51cd544..2e0b6882d 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 850cd8ebf..125520b05 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 bfea2dce1..2a841d0f9 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