From 6b89f87e4acda5ec4c97ec9951d33d2350481278 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 1 Nov 2026 03:19:34 +0100 Subject: [PATCH] UBJSON/BJData tests: assign the parsed value instead of casting it to void GCC reports -Werror=unused-result for static_cast(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 --- tests/src/unit-bjdata.cpp | 6 ++++-- tests/src/unit-ubjson.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/src/unit-bjdata.cpp b/tests/src/unit-bjdata.cpp index c7deda0ba..04ee3acc4 100644 --- a/tests/src/unit-bjdata.cpp +++ b/tests/src/unit-bjdata.cpp @@ -4787,7 +4787,8 @@ TEST_CASE("BJData optimized arrays from contiguous and non-contiguous input") std::string bytewise_error; try { - static_cast(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(json::from_bjdata(bytewise.begin(), bytewise.end())); + json _; + _ = json::from_bjdata(bytewise.begin(), bytewise.end()); } catch (const json::exception& e) { diff --git a/tests/src/unit-ubjson.cpp b/tests/src/unit-ubjson.cpp index 2552dde48..04983da1c 100644 --- a/tests/src/unit-ubjson.cpp +++ b/tests/src/unit-ubjson.cpp @@ -3436,7 +3436,8 @@ TEST_CASE("UBJSON optimized arrays from contiguous and non-contiguous input") std::string bytewise_error; try { - static_cast(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(json::from_ubjson(bytewise.begin(), bytewise.end())); + json _; + _ = json::from_ubjson(bytewise.begin(), bytewise.end()); } catch (const json::exception& e) {