Unverified Commit b1fe6ee0 authored by Niels Lohmann's avatar Niels Lohmann Committed by GitHub

Merge pull request #2069 from nlohmann/issue2064

Fix returning reference to local temporary object
parents d9d1279a 9e0180b6
......@@ -2757,6 +2757,18 @@ class basic_json
return is_binary() ? m_value.binary : nullptr;
}
/// get a pointer to the value (binary)
internal_binary_t* get_impl_ptr(internal_binary_t* /*unused*/) noexcept
{
return is_binary() ? m_value.binary : nullptr;
}
/// get a pointer to the value (binary)
constexpr const internal_binary_t* get_impl_ptr(const internal_binary_t* /*unused*/) const noexcept
{
return is_binary() ? m_value.binary : nullptr;
}
/*!
@brief helper function to implement get_ref()
......
......@@ -18243,6 +18243,18 @@ class basic_json
return is_binary() ? m_value.binary : nullptr;
}
/// get a pointer to the value (binary)
internal_binary_t* get_impl_ptr(internal_binary_t* /*unused*/) noexcept
{
return is_binary() ? m_value.binary : nullptr;
}
/// get a pointer to the value (binary)
constexpr const internal_binary_t* get_impl_ptr(const internal_binary_t* /*unused*/) const noexcept
{
return is_binary() ? m_value.binary : nullptr;
}
/*!
@brief helper function to implement get_ref()
......
......@@ -826,7 +826,7 @@ TEST_CASE("constructors")
// check that NaN is serialized to null
CHECK(j.dump() == "null");
}
}
SECTION("infinity")
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment