From d9a0844723326bc65b2ee9c6f7b2ae2faeb1dbc6 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 8 Oct 2026 16:25:45 +0200 Subject: [PATCH] Fix document_data for old Clang (3.4-3.6) Drop the empty braced NSDMIs of the std::string members: old Clang rejects the defaulted constructor when it is used by a member initializer before the end of the class definition. Signed-off-by: Niels Lohmann --- include/nlohmann/detail/view/document_data.hpp | 4 ++-- single_include/nlohmann/json_view.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/nlohmann/detail/view/document_data.hpp b/include/nlohmann/detail/view/document_data.hpp index d74383a85..66275702c 100644 --- a/include/nlohmann/detail/view/document_data.hpp +++ b/include/nlohmann/detail/view/document_data.hpp @@ -35,8 +35,8 @@ struct document_data std::size_t tape_cap = 0; node* inline_tape = nullptr; ///< node array allocated together with this header std::size_t inline_cap = 0; - std::string arena{}; ///< decoded strings that contained escapes // NOLINT(readability-redundant-member-init) - std::string owned{}; ///< owned copy of the input, if any // NOLINT(readability-redundant-member-init) + std::string arena; ///< decoded strings that contained escapes + std::string owned; ///< owned copy of the input, if any std::array base = {{nullptr, nullptr, nullptr, nullptr}}; ///< string bases: source, arena (indexed by flags & node_flags::storage) bool discarded = true; diff --git a/single_include/nlohmann/json_view.hpp b/single_include/nlohmann/json_view.hpp index b853fcd82..6e2acab56 100644 --- a/single_include/nlohmann/json_view.hpp +++ b/single_include/nlohmann/json_view.hpp @@ -270,8 +270,8 @@ struct document_data std::size_t tape_cap = 0; node* inline_tape = nullptr; ///< node array allocated together with this header std::size_t inline_cap = 0; - std::string arena{}; ///< decoded strings that contained escapes // NOLINT(readability-redundant-member-init) - std::string owned{}; ///< owned copy of the input, if any // NOLINT(readability-redundant-member-init) + std::string arena; ///< decoded strings that contained escapes + std::string owned; ///< owned copy of the input, if any std::array base = {{nullptr, nullptr, nullptr, nullptr}}; ///< string bases: source, arena (indexed by flags & node_flags::storage) bool discarded = true;