From a711e1f5a721b12987b5748da37d3b8c2992764b Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 13 Jul 2021 15:37:57 +0200 Subject: [PATCH] :rotating_light: fix warnings --- include/nlohmann/json.hpp | 5 +++-- single_include/nlohmann/json.hpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index d18f082b4..a337c1c69 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -1304,10 +1304,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 (old_capacity != -1) + if (old_capacity != std::size_t(-1)) { // see https://github.com/nlohmann/json/issues/2838 JSON_ASSERT(type() == value_t::array); @@ -1322,6 +1322,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec j.m_parent = this; #else static_cast(j); + static_cast(old_capacity); #endif return j; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 3b5a7a75d..429964dd7 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -18339,10 +18339,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 (old_capacity != -1) + if (old_capacity != std::size_t(-1)) { // see https://github.com/nlohmann/json/issues/2838 JSON_ASSERT(type() == value_t::array); @@ -18357,6 +18357,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec j.m_parent = this; #else static_cast(j); + static_cast(old_capacity); #endif return j; }