🚨 fix warning

This commit is contained in:
Niels Lohmann 2021-03-23 13:56:46 +01:00
parent bc23505c54
commit 63c52b1201
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 18 additions and 12 deletions

View File

@ -1239,7 +1239,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
during destruction of objects when the invariant does not
need to hold.
*/
void assert_invariant(bool check_parents = true) const noexcept try
void assert_invariant(bool check_parents = true) const noexcept
{
JSON_ASSERT(m_type != value_t::object || m_value.object != nullptr);
JSON_ASSERT(m_type != value_t::array || m_value.array != nullptr);
@ -1247,16 +1247,19 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
JSON_ASSERT(m_type != value_t::binary || m_value.binary != nullptr);
#if JSON_DIAGNOSTICS
// cppcheck-suppress assertWithSideEffect
JSON_ASSERT(!check_parents || !is_structured() || std::all_of(begin(), end(), [this](const basic_json & j)
JSON_TRY
{
return j.m_parent == this;
}));
// cppcheck-suppress assertWithSideEffect
JSON_ASSERT(!check_parents || !is_structured() || std::all_of(begin(), end(), [this](const basic_json & j)
{
return j.m_parent == this;
}));
}
JSON_CATCH(...) {}
#else
static_cast<void>(check_parents);
#endif
}
catch (...) {}
void set_parents()
{

View File

@ -18052,7 +18052,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
during destruction of objects when the invariant does not
need to hold.
*/
void assert_invariant(bool check_parents = true) const noexcept try
void assert_invariant(bool check_parents = true) const noexcept
{
JSON_ASSERT(m_type != value_t::object || m_value.object != nullptr);
JSON_ASSERT(m_type != value_t::array || m_value.array != nullptr);
@ -18060,16 +18060,19 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
JSON_ASSERT(m_type != value_t::binary || m_value.binary != nullptr);
#if JSON_DIAGNOSTICS
// cppcheck-suppress assertWithSideEffect
JSON_ASSERT(!check_parents || !is_structured() || std::all_of(begin(), end(), [this](const basic_json & j)
JSON_TRY
{
return j.m_parent == this;
}));
// cppcheck-suppress assertWithSideEffect
JSON_ASSERT(!check_parents || !is_structured() || std::all_of(begin(), end(), [this](const basic_json & j)
{
return j.m_parent == this;
}));
}
JSON_CATCH(...) {}
#else
static_cast<void>(check_parents);
#endif
}
catch (...) {}
void set_parents()
{