1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-31 10:24:23 +03:00

Fix compilation failure and warnings with NVHPC (#4744)

* 🚨 fix warnings

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 fix warnings

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* ⚗️ enable ranges support

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🔥 remove ci_nvhpc job

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* ⚗️ enable ranges support

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🔥 remove ci_nvhpc job

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚨 fix warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2025-04-16 16:09:21 +02:00
committed by GitHub
parent 96c1b52f1c
commit 88c92e605c
6 changed files with 12 additions and 6 deletions

View File

@ -955,7 +955,8 @@ TEST_CASE("iterators 2")
};
json j_expected{"a_key", "b_key", "c_key"};
auto transformed = j.items() | std::views::transform([](const auto & item)
// NOLINTNEXTLINE(fuchsia-trailing-return)
auto transformed = j.items() | std::views::transform([](const auto & item) -> std::string_view
{
return item.key();
});

View File

@ -566,7 +566,7 @@ TEST_CASE("regression tests 2")
const auto length = 300;
json dump_test;
dump_test["1"] = std::string(length, -1);
dump_test["1"] = std::string(length, static_cast<std::string::value_type>(-1));
std::string expected = R"({"1":")";
for (int i = 0; i < length; ++i)
@ -583,7 +583,7 @@ TEST_CASE("regression tests 2")
const auto length = 500;
json dump_test;
dump_test["1"] = std::string(length, -2);
dump_test["1"] = std::string(length, static_cast<std::string::value_type>(-2));
std::string expected = R"({"1":")";
for (int i = 0; i < length; ++i)

View File

@ -841,7 +841,7 @@ class Evil
public:
Evil() = default;
template <typename T>
Evil(T t) : m_i(sizeof(t))
Evil(const T& t) : m_i(sizeof(t))
{
static_cast<void>(t); // fix MSVC's C4100 warning
}
@ -863,6 +863,10 @@ TEST_CASE("Issue #924")
// silence Wunused-template warnings
Evil e(1);
CHECK(e.m_i >= 0);
// suppress warning: function "<unnamed>::Evil::Evil(T) [with T=std::string]" was declared but never referenced [declared_but_not_referenced]
Evil e2(std::string("foo"));
CHECK(e2.m_i >= 0);
}
TEST_CASE("Issue #1237")