From 110cd31e8f3374a7d42050c92ad3bb5df88d86c3 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 28 Aug 2026 17:53:02 +0000 Subject: [PATCH] Use character literals for the signed BinaryType test MSVC rejects char(0xFF) with C4310 (cast truncates constant value), which the Windows workflow treats as an error. The character literals carry the same byte values without a narrowing cast. Signed-off-by: Niels Lohmann --- tests/src/unit-regression2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/unit-regression2.cpp b/tests/src/unit-regression2.cpp index 7397f7534..fb1dffd1b 100644 --- a/tests/src/unit-regression2.cpp +++ b/tests/src/unit-regression2.cpp @@ -1167,7 +1167,7 @@ TEST_CASE("regression tests 2") using json_char_binary = nlohmann::basic_json < std::map, std::vector, std::string, bool, std::int64_t, std::uint64_t, double, std::allocator, nlohmann::adl_serializer, std::vector, void >; - const std::vector chars{char(0), char(1), char(0xFF)}; + const std::vector chars{'\0', '\x01', '\xFF'}; CHECK(json_char_binary::binary(chars).dump() == R"({"bytes":[0,1,255],"subtype":null})"); // the default binary type is unchanged