From 448c9dd6806aad439b4e238c50c219b8df7824af Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 30 Sep 2026 00:29:09 +0200 Subject: [PATCH] Fix old clang: do not declare the defaulted document_data() noexcept With the nested struct object_index, clang 4 (and, by the same bug, the clang 3.x of ci_test_compilers_clang) rejects the explicitly noexcept defaulted constructor: "default member initializer for 'indexes' needed within definition of enclosing class 'document_data' outside of member functions". Nothing depends on the constructor being noexcept, so let it take the implicit exception specification. Signed-off-by: Niels Lohmann --- include/nlohmann/detail/view/document_data.hpp | 2 +- single_include/nlohmann/json_view.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/view/document_data.hpp b/include/nlohmann/detail/view/document_data.hpp index d56c1a119..fd72ee66e 100644 --- a/include/nlohmann/detail/view/document_data.hpp +++ b/include/nlohmann/detail/view/document_data.hpp @@ -77,7 +77,7 @@ struct document_data } }; - document_data() noexcept = default; + document_data() = default; document_data(const document_data&) = delete; document_data(document_data&&) = delete; document_data& operator=(const document_data&) = delete; diff --git a/single_include/nlohmann/json_view.hpp b/single_include/nlohmann/json_view.hpp index 40ec3e89f..be5c0ad6d 100644 --- a/single_include/nlohmann/json_view.hpp +++ b/single_include/nlohmann/json_view.hpp @@ -320,7 +320,7 @@ struct document_data } }; - document_data() noexcept = default; + document_data() = default; document_data(const document_data&) = delete; document_data(document_data&&) = delete; document_data& operator=(const document_data&) = delete;