Silence -Wunneeded-internal-declaration warnings without emitting code
This commit is contained in:
parent
de7906a903
commit
e2d15d7335
@ -47,8 +47,14 @@ static_assert(!noexcept(std::declval<json>().get<pod_bis>()), "");
|
||||
static_assert(noexcept(json(pod{})), "");
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("runtime checks")
|
||||
TEST_CASE("noexcept")
|
||||
{
|
||||
// silence -Wunneeded-internal-declaration errors
|
||||
static_cast<void>(static_cast<void(*)(json&, pod)>(&to_json));
|
||||
static_cast<void>(static_cast<void(*)(json&, pod_bis)>(&to_json));
|
||||
static_cast<void>(static_cast<void(*)(const json&, pod)>(&from_json));
|
||||
static_cast<void>(static_cast<void(*)(const json&, pod_bis)>(&from_json));
|
||||
|
||||
SECTION("nothrow-copy-constructible exceptions")
|
||||
{
|
||||
// for ERR60-CPP (https://github.com/nlohmann/json/issues/531):
|
||||
@ -63,16 +69,6 @@ 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());
|
||||
}
|
||||
}
|
||||
|
||||
DOCTEST_GCC_SUPPRESS_WARNING_POP
|
||||
|
||||
Loading…
Reference in New Issue
Block a user