What is the issue you have?
The entire range of uint64_t cannot be serialized. This is a bug, because if the type is supported, then it should be supported completely.
Please describe the steps to reproduce the issue.
- Try to serialize a sufficiently large value
Can you provide a small but working code example?
set val = std::numeric_limits<uint64_t>::max() in the example below:
class NodeId
{
public:
constexpr explicit NodeId(uint64_t val): m_value{val} {}
constexpr NodeId(): m_value{0} {}
// other members
private:
uint64_t m_value;
};
inline void to_json(nlohmann::json& obj, NodeId id) { obj = id.value(); }
What is the expected behavior?
If val = val = std::numeric_limits<uint64_t>::max() , then it should print 18446744073709551615, or a compilation error, that tells me that the type cannot be serialized.
And what is the actual behavior instead?
18446744073709552000 is the actual value.
Which compiler and operating system are you using?
- Compiler: g++-10 (Ubuntu 10.2.0-5ubuntu1~20.04) 10.2.0
- Operating system: Ubuntu 20.04.1 LTS
- Architecture: x86-64
Which version of the library did you use?
If you experience a compilation error: can you compile and run the unit tests? No compilation error
What is the issue you have?
The entire range of
uint64_tcannot be serialized. This is a bug, because if the type is supported, then it should be supported completely.Please describe the steps to reproduce the issue.
Can you provide a small but working code example?
set
val=std::numeric_limits<uint64_t>::max()in the example below:What is the expected behavior?
If val =
val=std::numeric_limits<uint64_t>::max(), then it should print 18446744073709551615, or a compilation error, that tells me that the type cannot be serialized.And what is the actual behavior instead?
18446744073709552000 is the actual value.
Which compiler and operating system are you using?
Which version of the library did you use?
developbranchIf you experience a compilation error: can you compile and run the unit tests? No compilation error