From 9b179cee1e1813020fbd14d15bcced6b4ffee109 Mon Sep 17 00:00:00 2001 From: fhgffy <102001626+fhgffy@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:29:22 +0800 Subject: [PATCH] Handle all value_t enumerators in has_no_children() (#5770) 2026-10-07: add the scalar enum labels already handled by the default branch so -Werror=switch-enum builds succeed. Keep the existing behavior and synchronize the generated single header. Signed-off-by: fhgffy <102001626+fhgffy@users.noreply.github.com> --- include/nlohmann/json.hpp | 8 ++++++++ single_include/nlohmann/json.hpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index f698163fe..8cf3f8397 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -633,6 +633,14 @@ private: return v.m_data.m_value.array->empty(); case value_t::object: return v.m_data.m_value.object->empty(); + case value_t::null: + case value_t::string: + case value_t::boolean: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::number_float: + case value_t::binary: + case value_t::discarded: default: return true; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index b6e5ca7c5..9a1aaeecd 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -27872,6 +27872,14 @@ private: return v.m_data.m_value.array->empty(); case value_t::object: return v.m_data.m_value.object->empty(); + case value_t::null: + case value_t::string: + case value_t::boolean: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::number_float: + case value_t::binary: + case value_t::discarded: default: return true; }