Skip to content

Commit

Permalink
🚨 fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Mar 15, 2024
1 parent 7b89d3a commit cc4d7f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,11 +1213,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
/// @sa https://json.nlohmann.me/api/basic_json/basic_json/
basic_json(basic_json&& other) noexcept
: json_base_class_t(std::forward<json_base_class_t>(other)),
m_data(std::move(other.m_data))
// check that passed value is valid (has to be done before moving)
m_data(std::move((other.assert_invariant(false), other.m_data)))
{
// check that passed value is valid
other.assert_invariant(false);

// invalidate payload
other.m_data.m_type = value_t::null;
other.m_data.m_value = {};
Expand Down
6 changes: 2 additions & 4 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20516,11 +20516,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
/// @sa https://json.nlohmann.me/api/basic_json/basic_json/
basic_json(basic_json&& other) noexcept
: json_base_class_t(std::forward<json_base_class_t>(other)),
m_data(std::move(other.m_data))
// check that passed value is valid (has to be done before moving)
m_data(std::move((other.assert_invariant(false), other.m_data)))
{
// check that passed value is valid
other.assert_invariant(false);

// invalidate payload
other.m_data.m_type = value_t::null;
other.m_data.m_value = {};
Expand Down

0 comments on commit cc4d7f1

Please sign in to comment.