From 1ee958e49c848e20c48f1e2112de79914dc769b4 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 1 Nov 2026 03:19:32 +0100 Subject: [PATCH] MessagePack tests: assign the parsed value instead of casting it to void GCC (ci_test_gcc) reports -Werror=unused-result for static_cast(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 --- tests/src/unit-msgpack.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/src/unit-msgpack.cpp b/tests/src/unit-msgpack.cpp index bfd9b45a8..9b5891fdd 100644 --- a/tests/src/unit-msgpack.cpp +++ b/tests/src/unit-msgpack.cpp @@ -2275,7 +2275,8 @@ TEST_CASE("MessagePack arrays of scalars from contiguous and non-contiguous inpu std::string bytewise_error; try { - static_cast(json::from_msgpack(contiguous)); + json _; + _ = json::from_msgpack(contiguous); } catch (const json::parse_error& e) { @@ -2283,7 +2284,8 @@ TEST_CASE("MessagePack arrays of scalars from contiguous and non-contiguous inpu } try { - static_cast(json::from_msgpack(bytewise.begin(), bytewise.end())); + json _; + _ = json::from_msgpack(bytewise.begin(), bytewise.end()); } catch (const json::parse_error& e) {