diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index b80e07ef7..a3c0af1e0 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -1212,11 +1212,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// @brief move constructor /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ basic_json(basic_json&& other) noexcept - : json_base_class_t(std::move(other)), + : json_base_class_t(std::forward(other)), m_data(std::move(other.m_data)) { // check that passed value is valid - other.assert_invariant(false); // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved) + other.assert_invariant(false); // invalidate payload other.m_data.m_type = value_t::null; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index dbbe68458..df3d55537 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -20428,11 +20428,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// @brief move constructor /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ basic_json(basic_json&& other) noexcept - : json_base_class_t(std::move(other)), + : json_base_class_t(std::forward(other)), m_data(std::move(other.m_data)) { // check that passed value is valid - other.assert_invariant(false); // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved) + other.assert_invariant(false); // invalidate payload other.m_data.m_type = value_t::null;