From 5ed07097faa6c50199c4a3b66e5ed37d4fbfccc2 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Tue, 13 Jan 2026 17:19:38 +0100 Subject: [PATCH] Fix -Wtautological-constant-out-of-range-compare in serializer (#5050) Signed-off-by: Charles Cabergs --- include/nlohmann/detail/output/serializer.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp index 03d6ba352..aeec34eeb 100644 --- a/include/nlohmann/detail/output/serializer.hpp +++ b/include/nlohmann/detail/output/serializer.hpp @@ -919,7 +919,7 @@ class serializer } }; - JSON_ASSERT(byte < utf8d.size()); + JSON_ASSERT(static_cast(byte) < utf8d.size()); const std::uint8_t type = utf8d[byte]; codep = (state != UTF8_ACCEPT) diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 57a90cbd4..cd4924d96 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -19755,7 +19755,7 @@ class serializer } }; - JSON_ASSERT(byte < utf8d.size()); + JSON_ASSERT(static_cast(byte) < utf8d.size()); const std::uint8_t type = utf8d[byte]; codep = (state != UTF8_ACCEPT)