-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
kind: bugsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Milestone
Description
Description
The behavior of serializing and de-sereailzing an empty tuple changed from 3.9.1
to 3.10.0
.
null
used to de-serialize without a problem to std::tuple<>
but since throws an error since 3.10.0
.
The change of behavior happened in #2576.
Note that I'm not entirely sure this is a bug per-say, but we relied on this behavior in https://github.com/luxonis/depthai-core so I decided to report in case the previous behavior was "more correct".
Reproduction steps
To reproduce run the MRE with both 3.10.0
and 3.9.1
.
Expected vs. actual results
Expected - null
succesfully de-serializes when j.get<std::tuple<>>()
is called on null
.
Actual:
terminate called after throwing an instance of 'nlohmann::detail::type_error'
what(): [json.exception.type_error.302] type must be array, but is null
Minimal code example
#include <nlohmann/json.hpp>
int main() {
auto sourceTuple = std::tuple<>();
nlohmann::json j = sourceTuple;
auto returnedTuple = j.get<std::tuple<>>();
return 0;
}
Error messages
terminate called after throwing an instance of 'nlohmann::detail::type_error'
what(): [json.exception.type_error.302] type must be array, but is null
Aborted (core dumped)
Compiler and operating system
Ubuntu 20.04, GCC 9.4.0
Library version
3.11.3
Validation
- The bug also occurs if the latest version from the
develop
branch is used. - I can successfully compile and run the unit tests.
asahtik
Metadata
Metadata
Assignees
Labels
kind: bugsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation