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:
2 files changed
+8
-4
No files matched your search
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user