mirror of
https://github.com/nlohmann/json.git
synced 2026-03-07 09:41:23 +00:00
Fix ordered_map ctor with initializer_list (#3370)
One of the ordered_map constructors was incorrectly accepting a std::initializer_list<T> instead of std::initializer_list<value_type>. Add regression test. Fixes #3343.
This commit is contained in:
committed by
GitHub
parent
c6d8892e5d
commit
0fd95d2e28
@@ -835,6 +835,18 @@ TEST_CASE("regression tests 2")
|
||||
|
||||
CHECK(j.dump() == "[1,4]");
|
||||
}
|
||||
|
||||
SECTION("issue #3343 - json and ordered_json are not interchangable")
|
||||
{
|
||||
json::object_t jobj({ { "product", "one" } });
|
||||
ordered_json::object_t ojobj({{"product", "one"}});
|
||||
|
||||
auto jit = jobj.begin();
|
||||
auto ojit = ojobj.begin();
|
||||
|
||||
CHECK(jit->first == ojit->first);
|
||||
CHECK(jit->second.get<std::string>() == ojit->second.get<std::string>());
|
||||
}
|
||||
}
|
||||
|
||||
DOCTEST_CLANG_SUPPRESS_WARNING_POP
|
||||
|
||||
Reference in New Issue
Block a user