Programs can not be compiled compile with header nlohmann/json.hpp

Bug #1815441 reported by Silver Ghost
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nlohmann-json (Ubuntu)
New
Undecided
Unassigned

Bug Description

Ubuntu release 18.04.1
Package version 2.1.1-1.1

Bug is reported already reported and resolved in upstream.

Compiling error from upstream issue about Ubuntu[0]:
In file included from test_json.cpp:6:0:
/usr/include/nlohmann/json.hpp: In function ‘bool nlohmann::operator<(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_reference, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_reference)’:
/usr/include/nlohmann/json.hpp:6057:62: error: wrong number of template arguments (1, should be 2)
                     return *lhs.m_value.array < *rhs.m_value.array;
                                                              ^~~~~
In file included from /usr/include/nlohmann/json.hpp:33:0,
                 from test_json.cpp:6:
/usr/include/c++/7/array:94:12: note: provided for ‘template<class _Tp, long unsigned int _Nm> struct std::array’
     struct array
            ^~~~~

Upstream issue discussing this bug - [1]

Proposed solution[2]:
> Changing the line in json.hpp to read
> return (*lhs.m_value.array) < *rhs.m_value.array;
> seems to fix the error using that simple test case.

Bug was fixed in [3]. Versions >=3.0.0 has this fix.

[0] https://github.com/nlohmann/json/issues/1110
[1] https://github.com/nlohmann/json/issues/590
[2] https://github.com/nlohmann/json/issues/590#issuecomment-305988306
[3] https://github.com/nlohmann/json/commit/1a9d76679a3f41a038a89742fba29d81ee24ce82

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.