From 28ba5e49fe0b10e6c56520b56d2c59ea42442684 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 14 Oct 2021 08:00:39 +0200 Subject: [PATCH] :recycle: default initialization --- include/nlohmann/json.hpp | 11 +---------- single_include/nlohmann/json.hpp | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 269ee680a..6058d8fe1 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -3069,16 +3069,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec ValueType get_impl(detail::priority_tag<0> /*unused*/) const noexcept(noexcept( JSONSerializer::from_json(std::declval(), std::declval()))) { -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Weffc++" -#endif - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init,hicpp-member-init): see https://github.com/nlohmann/json/issues/3077 - ValueType ret; -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif - + auto ret = ValueType(); JSONSerializer::from_json(*this, ret); return ret; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 8ca12791c..5cfd0086f 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -20556,16 +20556,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec ValueType get_impl(detail::priority_tag<0> /*unused*/) const noexcept(noexcept( JSONSerializer::from_json(std::declval(), std::declval()))) { -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Weffc++" -#endif - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init,hicpp-member-init): see https://github.com/nlohmann/json/issues/3077 - ValueType ret; -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif - + auto ret = ValueType(); JSONSerializer::from_json(*this, ret); return ret; }