mirror of
https://github.com/nlohmann/json.git
synced 2026-02-13 00:52:17 +00:00
🚨 fix warnings #2113
This commit is contained in:
@@ -46,7 +46,12 @@ void to_json(json&, pod) noexcept;
|
||||
void to_json(json&, pod_bis);
|
||||
void from_json(const json&, pod) noexcept;
|
||||
void from_json(const json&, pod_bis);
|
||||
static json* j;
|
||||
void to_json(json&, pod) noexcept {}
|
||||
void to_json(json&, pod_bis) {}
|
||||
void from_json(const json&, pod) noexcept {}
|
||||
void from_json(const json&, pod_bis) {}
|
||||
|
||||
static json* j = nullptr;
|
||||
|
||||
static_assert(noexcept(json{}), "");
|
||||
static_assert(noexcept(nlohmann::to_json(*j, 2)), "");
|
||||
@@ -79,4 +84,14 @@ TEST_CASE("runtime checks")
|
||||
CHECK(std::is_nothrow_copy_constructible<json::out_of_range>::value == std::is_nothrow_copy_constructible<std::runtime_error>::value);
|
||||
CHECK(std::is_nothrow_copy_constructible<json::other_error>::value == std::is_nothrow_copy_constructible<std::runtime_error>::value);
|
||||
}
|
||||
|
||||
SECTION("silence -Wunneeded-internal-declaration errors")
|
||||
{
|
||||
j = nullptr;
|
||||
json j2;
|
||||
to_json(j2, pod());
|
||||
to_json(j2, pod_bis());
|
||||
from_json(j2, pod());
|
||||
from_json(j2, pod_bis());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user