UBJSON/BJData tests: assign the parsed value instead of casting it to void

GCC reports -Werror=unused-result for static_cast<void>(json::from_ubjson(...))
and json::from_bjdata(...): a cast to void does not silence warn_unused_result
on GCC. Assign to a json, as the other tests do.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-11-01 03:19:34 +01:00
1 parent dbf7756f7b
commit 6b89f87e4a
2 files changed
+8 -4

No files matched your search

+4 -2
View File
@@ -4787,7 +4787,8 @@ TEST_CASE("BJData optimized arrays from contiguous and non-contiguous input")
std::string bytewise_error;
try
{
static_cast<void>(json::from_bjdata(contiguous));
json _;
_ = json::from_bjdata(contiguous);
}
catch (const json::exception& e)
{
@@ -4795,7 +4796,8 @@ TEST_CASE("BJData optimized arrays from contiguous and non-contiguous input")
}
try
{
static_cast<void>(json::from_bjdata(bytewise.begin(), bytewise.end()));
json _;
_ = json::from_bjdata(bytewise.begin(), bytewise.end());
}
catch (const json::exception& e)
{
+4 -2
View File
@@ -3436,7 +3436,8 @@ TEST_CASE("UBJSON optimized arrays from contiguous and non-contiguous input")
std::string bytewise_error;
try
{
static_cast<void>(json::from_ubjson(contiguous));
json _;
_ = json::from_ubjson(contiguous);
}
catch (const json::exception& e)
{
@@ -3444,7 +3445,8 @@ TEST_CASE("UBJSON optimized arrays from contiguous and non-contiguous input")
}
try
{
static_cast<void>(json::from_ubjson(bytewise.begin(), bytewise.end()));
json _;
_ = json::from_ubjson(bytewise.begin(), bytewise.end());
}
catch (const json::exception& e)
{