🚨 fix warnings

This commit is contained in:
Niels Lohmann 2021-07-13 15:37:57 +02:00 committed by Chaoya Li
parent 45c77b1c72
commit 8b643e4362
2 changed files with 6 additions and 4 deletions

View File

@ -1304,10 +1304,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
return it; return it;
} }
reference set_parent(reference j, std::size_t old_capacity = -1) reference set_parent(reference j, std::size_t old_capacity = std::size_t(-1))
{ {
#if JSON_DIAGNOSTICS #if JSON_DIAGNOSTICS
if (old_capacity != -1) if (old_capacity != std::size_t(-1))
{ {
// see https://github.com/nlohmann/json/issues/2838 // see https://github.com/nlohmann/json/issues/2838
JSON_ASSERT(type() == value_t::array); JSON_ASSERT(type() == value_t::array);
@ -1322,6 +1322,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
j.m_parent = this; j.m_parent = this;
#else #else
static_cast<void>(j); static_cast<void>(j);
static_cast<void>(old_capacity);
#endif #endif
return j; return j;
} }

View File

@ -18348,10 +18348,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
return it; return it;
} }
reference set_parent(reference j, std::size_t old_capacity = -1) reference set_parent(reference j, std::size_t old_capacity = std::size_t(-1))
{ {
#if JSON_DIAGNOSTICS #if JSON_DIAGNOSTICS
if (old_capacity != -1) if (old_capacity != std::size_t(-1))
{ {
// see https://github.com/nlohmann/json/issues/2838 // see https://github.com/nlohmann/json/issues/2838
JSON_ASSERT(type() == value_t::array); JSON_ASSERT(type() == value_t::array);
@ -18366,6 +18366,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
j.m_parent = this; j.m_parent = this;
#else #else
static_cast<void>(j); static_cast<void>(j);
static_cast<void>(old_capacity);
#endif #endif
return j; return j;
} }