Add assertion to converting constructor (#3517)
The converting basic_json constructor can inadvertently change the value type of its parameter. Assert that both basic_json values are of the same value type after conversion.
This commit is contained in:
1 parent
560cede06d
commit
7a6e28acfa
2 files changed
+2
No files matched your search
@@ -916,6 +916,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
default: // LCOV_EXCL_LINE
|
||||
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
|
||||
}
|
||||
JSON_ASSERT(m_type == val.type());
|
||||
set_parents();
|
||||
assert_invariant();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user