nlohmann_json: fix tests to compile with clang-19

https://releases.llvm.org/19.1.0/projects/libcxx/docs/ReleaseNotes.html

> The base template for std::char_traits has been removed in LLVM 19. If
> you are using std::char_traits with types other than char, wchar_t,
> char8_t, char16_t, char32_t or a custom character type for which you
> specialized std::char_traits, your code will stop working.

authored by Reno Dakota and committed by Emily 8169aae6 4e9d1421

+104
+98
pkgs/by-name/nl/nlohmann_json/make-tests-build-clang-19.diff
··· 1 + diff --git a/tests/src/unit-bson.cpp b/tests/src/unit-bson.cpp 2 + index 13216f2..fdfc350 100644 3 + --- a/tests/src/unit-bson.cpp 4 + +++ b/tests/src/unit-bson.cpp 5 + @@ -621,7 +621,7 @@ TEST_CASE("BSON input/output_adapters") 6 + { 7 + SECTION("std::ostringstream") 8 + { 9 + - std::basic_ostringstream<std::uint8_t> ss; 10 + + std::basic_ostringstream<char> ss; 11 + json::to_bson(json_representation, ss); 12 + json j3 = json::from_bson(ss.str()); 13 + CHECK(json_representation == j3); 14 + diff --git a/tests/src/unit-cbor.cpp b/tests/src/unit-cbor.cpp 15 + index be94d2f..2b396b7 100644 16 + --- a/tests/src/unit-cbor.cpp 17 + +++ b/tests/src/unit-cbor.cpp 18 + @@ -1881,7 +1881,7 @@ TEST_CASE("single CBOR roundtrip") 19 + { 20 + SECTION("std::ostringstream") 21 + { 22 + - std::basic_ostringstream<std::uint8_t> ss; 23 + + std::basic_ostringstream<char> ss; 24 + json::to_cbor(j1, ss); 25 + json j3 = json::from_cbor(ss.str()); 26 + CHECK(j1 == j3); 27 + diff --git a/tests/src/unit-deserialization.cpp b/tests/src/unit-deserialization.cpp 28 + index 3bc161f..e4918b0 100644 29 + --- a/tests/src/unit-deserialization.cpp 30 + +++ b/tests/src/unit-deserialization.cpp 31 + @@ -1131,13 +1131,11 @@ TEST_CASE("deserialization") 32 + } 33 + } 34 + 35 + + 36 + TEST_CASE_TEMPLATE("deserialization of different character types (ASCII)", T, 37 + - char, unsigned char, signed char, 38 + + char, 39 + wchar_t, 40 + - char16_t, char32_t, 41 + - std::uint8_t, std::int8_t, 42 + - std::int16_t, std::uint16_t, 43 + - std::int32_t, std::uint32_t) 44 + + char16_t, char32_t) 45 + { 46 + std::vector<T> const v = {'t', 'r', 'u', 'e'}; 47 + CHECK(json::parse(v) == json(true)); 48 + @@ -1163,7 +1161,7 @@ TEST_CASE_TEMPLATE("deserialization of different character types (UTF-8)", T, 49 + } 50 + 51 + TEST_CASE_TEMPLATE("deserialization of different character types (UTF-16)", T, 52 + - char16_t, std::uint16_t) 53 + + char16_t) 54 + { 55 + // a star emoji 56 + std::vector<T> const v = {static_cast<T>('"'), static_cast<T>(0x2b50), static_cast<T>(0xfe0f), static_cast<T>('"')}; 57 + @@ -1176,7 +1174,7 @@ TEST_CASE_TEMPLATE("deserialization of different character types (UTF-16)", T, 58 + } 59 + 60 + TEST_CASE_TEMPLATE("deserialization of different character types (UTF-32)", T, 61 + - char32_t, std::uint32_t) 62 + + char32_t) 63 + { 64 + // a star emoji 65 + std::vector<T> const v = {static_cast<T>('"'), static_cast<T>(0x2b50), static_cast<T>(0xfe0f), static_cast<T>('"')}; 66 + diff --git a/tests/src/unit-msgpack.cpp b/tests/src/unit-msgpack.cpp 67 + index 61162af..cfbb1fa 100644 68 + --- a/tests/src/unit-msgpack.cpp 69 + +++ b/tests/src/unit-msgpack.cpp 70 + @@ -1604,7 +1604,7 @@ TEST_CASE("single MessagePack roundtrip") 71 + { 72 + SECTION("std::ostringstream") 73 + { 74 + - std::basic_ostringstream<std::uint8_t> ss; 75 + + std::basic_ostringstream<char> ss; 76 + json::to_msgpack(j1, ss); 77 + json j3 = json::from_msgpack(ss.str()); 78 + CHECK(j1 == j3); 79 + diff --git a/tests/src/unit-regression2.cpp b/tests/src/unit-regression2.cpp 80 + index fab9aae..98947c5 100644 81 + --- a/tests/src/unit-regression2.cpp 82 + +++ b/tests/src/unit-regression2.cpp 83 + @@ -674,6 +674,7 @@ TEST_CASE("regression tests 2") 84 + CHECK(j.dump() == "{}"); 85 + } 86 + 87 + +#if 0 88 + #ifdef JSON_HAS_CPP_20 89 + #if __has_include(<span>) 90 + SECTION("issue #2546 - parsing containers of std::byte") 91 + @@ -684,6 +685,7 @@ TEST_CASE("regression tests 2") 92 + CHECK(j.dump() == "\"Hello, world!\""); 93 + } 94 + #endif 95 + +#endif 96 + #endif 97 + 98 + SECTION("issue #2574 - Deserialization to std::array, std::pair, and std::tuple with non-default constructable types fails")
+6
pkgs/by-name/nl/nlohmann_json/package.nix
··· 21 21 hash = "sha256-7F0Jon+1oWL7uqet5i1IgHX0fUw/+z0QwEcA3zs5xHg="; 22 22 }; 23 23 24 + patches = lib.optionals stdenv.cc.isClang [ 25 + # tests fail to compile on clang-19 26 + # https://github.com/nlohmann/json/issues/4490 27 + ./make-tests-build-clang-19.diff 28 + ]; 29 + 24 30 nativeBuildInputs = [ cmake ]; 25 31 26 32 cmakeFlags = [