MessagePack tests: assign the parsed value instead of casting it to void

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

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-11-01 03:19:32 +01:00
1 parent d2436351cd
commit 1ee958e49c
1 file changed
+4 -2
+4 -2
View File
@@ -2275,7 +2275,8 @@ TEST_CASE("MessagePack arrays of scalars from contiguous and non-contiguous inpu
std::string bytewise_error; std::string bytewise_error;
try try
{ {
static_cast<void>(json::from_msgpack(contiguous)); json _;
_ = json::from_msgpack(contiguous);
} }
catch (const json::parse_error& e) catch (const json::parse_error& e)
{ {
@@ -2283,7 +2284,8 @@ TEST_CASE("MessagePack arrays of scalars from contiguous and non-contiguous inpu
} }
try try
{ {
static_cast<void>(json::from_msgpack(bytewise.begin(), bytewise.end())); json _;
_ = json::from_msgpack(bytewise.begin(), bytewise.end());
} }
catch (const json::parse_error& e) catch (const json::parse_error& e)
{ {