From c67e101b77c0e3f4bc6f1df91141aac4c674ac50 Mon Sep 17 00:00:00 2001 From: luistung Date: Fri, 16 Sep 2022 03:09:42 +0800 Subject: [PATCH] fix for 3732 --- include/nlohmann/json.hpp | 4 ++++ single_include/nlohmann/json.hpp | 4 ++++ tests/src/unit-ordered_json.cpp | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index b1c23f7d7..af69cac54 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -5123,6 +5123,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// @} }; +// Explicit instantiation +// fix for issue #3732 +template class nlohmann::basic_json; + /// @brief user-defined to_string function for JSON values /// @sa https://json.nlohmann.me/api/basic_json/to_string/ NLOHMANN_BASIC_JSON_TPL_DECLARATION diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index efac6d2d2..759517e1c 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -24339,6 +24339,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// @} }; +// Explicit instantiation +// fix for issue #3732 +template class nlohmann::basic_json; + /// @brief user-defined to_string function for JSON values /// @sa https://json.nlohmann.me/api/basic_json/to_string/ NLOHMANN_BASIC_JSON_TPL_DECLARATION diff --git a/tests/src/unit-ordered_json.cpp b/tests/src/unit-ordered_json.cpp index 4e853cc3c..44bc96679 100644 --- a/tests/src/unit-ordered_json.cpp +++ b/tests/src/unit-ordered_json.cpp @@ -12,6 +12,12 @@ using nlohmann::json; using nlohmann::ordered_json; +//fix for issue #3732 +void test(nlohmann::detail::iteration_proxy_value < + nlohmann::detail::iter_impl> const& val) +{ + static_cast(val.value()); +} TEST_CASE("ordered_json") {