mirror of
https://github.com/nlohmann/json.git
synced 2026-10-02 20:50:32 +00:00
Fix CI: value-initialize a const json_view for clang 3.6
clang 3.6 rejects `const json_view invalid;` (no user-provided default constructor, CWG 253), as fixed in json-view/10-view-document. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -942,7 +942,7 @@ TEST_CASE("json_view values")
|
|||||||
// a duplicate key: the last value, as parse()
|
// a duplicate key: the last value, as parse()
|
||||||
CHECK((json_document::parse(R"({"a":1,"a":2})").root().get<std::map<std::string, int>>() == std::map<std::string, int> {{"a", 2}}));
|
CHECK((json_document::parse(R"({"a":1,"a":2})").root().get<std::map<std::string, int>>() == std::map<std::string, int> {{"a", 2}}));
|
||||||
|
|
||||||
const json_view invalid;
|
const json_view invalid{};
|
||||||
CHECK_THROWS_WITH_AS(invalid.get<int>(), "[json.exception.type_error.302] type must be number, but is discarded", json::type_error&);
|
CHECK_THROWS_WITH_AS(invalid.get<int>(), "[json.exception.type_error.302] type must be number, but is discarded", json::type_error&);
|
||||||
CHECK(invalid.get<json>().is_discarded());
|
CHECK(invalid.get<json>().is_discarded());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user