From e60002a1b36ace5d3d089feb1598f24e5bd59b0e Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 31 Jul 2017 23:17:14 +0200 Subject: [PATCH] :hammer: fixed GCC warnings in #663 https://github.com/nlohmann/json/pull/663#issuecomment-318931884 --- src/json.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/json.hpp b/src/json.hpp index ac41a53394..26e0b4f4d1 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -6872,6 +6872,11 @@ class json_ref is_rvalue(true) {} + // class should be movable only + json_ref(json_ref&&) = default; + json_ref(const json_ref&) = delete; + json_ref& operator=(const json_ref&) = delete; + value_type moved_or_copied() const { if (is_rvalue) @@ -6895,7 +6900,7 @@ class json_ref } private: - mutable value_type owned_value; + mutable value_type owned_value = nullptr; value_type* value_ref = nullptr; const bool is_rvalue; }; @@ -9826,6 +9831,7 @@ class basic_json */ template < typename ValueType, typename std::enable_if < not std::is_pointer::value and + not std::is_same>::value and not std::is_same::value #ifndef _MSC_VER // fix for issue #167 operator<< ambiguity under VS2015 and not std::is_same>::value