diff --git a/pkgs/by-name/nl/nlohmann_json/make-tests-build-clang-19.diff b/pkgs/by-name/nl/nlohmann_json/make-tests-build-clang-19.diff new file mode 100644 index 000000000000..ceb869251469 --- /dev/null +++ b/pkgs/by-name/nl/nlohmann_json/make-tests-build-clang-19.diff @@ -0,0 +1,98 @@ +diff --git a/tests/src/unit-bson.cpp b/tests/src/unit-bson.cpp +index 13216f2..fdfc350 100644 +--- a/tests/src/unit-bson.cpp ++++ b/tests/src/unit-bson.cpp +@@ -621,7 +621,7 @@ TEST_CASE("BSON input/output_adapters") + { + SECTION("std::ostringstream") + { +- std::basic_ostringstream ss; ++ std::basic_ostringstream ss; + json::to_bson(json_representation, ss); + json j3 = json::from_bson(ss.str()); + CHECK(json_representation == j3); +diff --git a/tests/src/unit-cbor.cpp b/tests/src/unit-cbor.cpp +index be94d2f..2b396b7 100644 +--- a/tests/src/unit-cbor.cpp ++++ b/tests/src/unit-cbor.cpp +@@ -1881,7 +1881,7 @@ TEST_CASE("single CBOR roundtrip") + { + SECTION("std::ostringstream") + { +- std::basic_ostringstream ss; ++ std::basic_ostringstream ss; + json::to_cbor(j1, ss); + json j3 = json::from_cbor(ss.str()); + CHECK(j1 == j3); +diff --git a/tests/src/unit-deserialization.cpp b/tests/src/unit-deserialization.cpp +index 3bc161f..e4918b0 100644 +--- a/tests/src/unit-deserialization.cpp ++++ b/tests/src/unit-deserialization.cpp +@@ -1131,13 +1131,11 @@ TEST_CASE("deserialization") + } + } + ++ + TEST_CASE_TEMPLATE("deserialization of different character types (ASCII)", T, +- char, unsigned char, signed char, ++ char, + wchar_t, +- char16_t, char32_t, +- std::uint8_t, std::int8_t, +- std::int16_t, std::uint16_t, +- std::int32_t, std::uint32_t) ++ char16_t, char32_t) + { + std::vector const v = {'t', 'r', 'u', 'e'}; + CHECK(json::parse(v) == json(true)); +@@ -1163,7 +1161,7 @@ TEST_CASE_TEMPLATE("deserialization of different character types (UTF-8)", T, + } + + TEST_CASE_TEMPLATE("deserialization of different character types (UTF-16)", T, +- char16_t, std::uint16_t) ++ char16_t) + { + // a star emoji + std::vector const v = {static_cast('"'), static_cast(0x2b50), static_cast(0xfe0f), static_cast('"')}; +@@ -1176,7 +1174,7 @@ TEST_CASE_TEMPLATE("deserialization of different character types (UTF-16)", T, + } + + TEST_CASE_TEMPLATE("deserialization of different character types (UTF-32)", T, +- char32_t, std::uint32_t) ++ char32_t) + { + // a star emoji + std::vector const v = {static_cast('"'), static_cast(0x2b50), static_cast(0xfe0f), static_cast('"')}; +diff --git a/tests/src/unit-msgpack.cpp b/tests/src/unit-msgpack.cpp +index 61162af..cfbb1fa 100644 +--- a/tests/src/unit-msgpack.cpp ++++ b/tests/src/unit-msgpack.cpp +@@ -1604,7 +1604,7 @@ TEST_CASE("single MessagePack roundtrip") + { + SECTION("std::ostringstream") + { +- std::basic_ostringstream ss; ++ std::basic_ostringstream ss; + json::to_msgpack(j1, ss); + json j3 = json::from_msgpack(ss.str()); + CHECK(j1 == j3); +diff --git a/tests/src/unit-regression2.cpp b/tests/src/unit-regression2.cpp +index fab9aae..98947c5 100644 +--- a/tests/src/unit-regression2.cpp ++++ b/tests/src/unit-regression2.cpp +@@ -674,6 +674,7 @@ TEST_CASE("regression tests 2") + CHECK(j.dump() == "{}"); + } + ++#if 0 + #ifdef JSON_HAS_CPP_20 + #if __has_include() + SECTION("issue #2546 - parsing containers of std::byte") +@@ -684,6 +685,7 @@ TEST_CASE("regression tests 2") + CHECK(j.dump() == "\"Hello, world!\""); + } + #endif ++#endif + #endif + + SECTION("issue #2574 - Deserialization to std::array, std::pair, and std::tuple with non-default constructable types fails") diff --git a/pkgs/by-name/nl/nlohmann_json/package.nix b/pkgs/by-name/nl/nlohmann_json/package.nix index d690cc45b2f9..8acc3d2d27ec 100644 --- a/pkgs/by-name/nl/nlohmann_json/package.nix +++ b/pkgs/by-name/nl/nlohmann_json/package.nix @@ -21,6 +21,12 @@ in stdenv.mkDerivation (finalAttrs: { hash = "sha256-7F0Jon+1oWL7uqet5i1IgHX0fUw/+z0QwEcA3zs5xHg="; }; + patches = lib.optionals stdenv.cc.isClang [ + # tests fail to compile on clang-19 + # https://github.com/nlohmann/json/issues/4490 + ./make-tests-build-clang-19.diff + ]; + nativeBuildInputs = [ cmake ]; cmakeFlags = [