diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index ce37730c8..8d7638898 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -65,7 +65,7 @@ void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) break; } // LCOV_EXCL_START - else if (std::numeric_limits::has_quiet_NaN) + if (std::numeric_limits::has_quiet_NaN) { val = std::numeric_limits::quiet_NaN(); break; @@ -371,7 +371,7 @@ void from_json(const BasicJsonType& j, ArithmeticType& val) break; } // LCOV_EXCL_START - else if (std::numeric_limits::has_quiet_NaN) + if (std::numeric_limits::has_quiet_NaN) { val = std::numeric_limits::quiet_NaN(); break; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 6f3753cf3..c0ec74782 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3928,7 +3928,7 @@ void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) break; } // LCOV_EXCL_START - else if (std::numeric_limits::has_quiet_NaN) + if (std::numeric_limits::has_quiet_NaN) { val = std::numeric_limits::quiet_NaN(); break; @@ -4234,7 +4234,7 @@ void from_json(const BasicJsonType& j, ArithmeticType& val) break; } // LCOV_EXCL_START - else if (std::numeric_limits::has_quiet_NaN) + if (std::numeric_limits::has_quiet_NaN) { val = std::numeric_limits::quiet_NaN(); break; diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp index 5983c4450..459cfc3e1 100644 --- a/test/src/unit-conversions.cpp +++ b/test/src/unit-conversions.cpp @@ -936,6 +936,7 @@ TEST_CASE("value conversion") { CHECK_THROWS_AS(json(json::value_t::null).get(), json::type_error&); + CHECK_THROWS_AS(json(json::value_t::null).get(), json::type_error&); CHECK_THROWS_AS(json(json::value_t::object).get(), json::type_error&); CHECK_THROWS_AS(json(json::value_t::array).get(),