diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 16fb5a3a7..4676b2c5b 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -5728,7 +5728,9 @@ class basic_json switch (lhs_type) { case value_t::array: - return *lhs.m_value.array < *rhs.m_value.array; + // note parentheses are necessary, see + // https://github.com/nlohmann/json/issues/1530 + return (*lhs.m_value.array < *rhs.m_value.array); case value_t::object: return *lhs.m_value.object < *rhs.m_value.object; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 6b0702c43..7f86528f4 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -18493,7 +18493,9 @@ class basic_json switch (lhs_type) { case value_t::array: - return *lhs.m_value.array < *rhs.m_value.array; + // note parentheses are necessary, see + // https://github.com/nlohmann/json/issues/1530 + return (*lhs.m_value.array < *rhs.m_value.array); case value_t::object: return *lhs.m_value.object < *rhs.m_value.object;