From b2bbd2b1c8916c5c0f3020e35b9b0c52dbc99ffa Mon Sep 17 00:00:00 2001 From: Florian Albrechtskirchinger Date: Wed, 8 Jun 2022 08:49:48 +0200 Subject: [PATCH] Fix MSVC compiler warning --- tests/src/unit-bjdata.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/src/unit-bjdata.cpp b/tests/src/unit-bjdata.cpp index fe4aa97c5..70c37dec1 100644 --- a/tests/src/unit-bjdata.cpp +++ b/tests/src/unit-bjdata.cpp @@ -2541,14 +2541,11 @@ TEST_CASE("BJData") CHECK_THROWS_WITH_AS(_ = json::from_bjdata(vL), "[json.exception.parse_error.113] parse error at byte 11: syntax error while parsing BJData size: count in an optimized container must be positive", json::parse_error&); CHECK(json::from_bjdata(vL, true, false).is_discarded()); - if (sizeof(std::size_t) == 4) - { - CHECK_THROWS_WITH_AS(_ = json::from_bjdata(vM), "[json.exception.parse_error.408] parse error at byte 17: syntax error while parsing BJData size: integer value overflow", json::parse_error&); - } - else - { - CHECK_THROWS_WITH_AS(_ = json::from_bjdata(vM), "[json.exception.parse_error.408] parse error at byte 18: syntax error while parsing BJData size: excessive ndarray size caused overflow", json::parse_error&); - } +#if SIZE_MAX == 0xffffffff + CHECK_THROWS_WITH_AS(_ = json::from_bjdata(vM), "[json.exception.parse_error.408] parse error at byte 17: syntax error while parsing BJData size: integer value overflow", json::parse_error&); +#else + CHECK_THROWS_WITH_AS(_ = json::from_bjdata(vM), "[json.exception.parse_error.408] parse error at byte 18: syntax error while parsing BJData size: excessive ndarray size caused overflow", json::parse_error&); +#endif CHECK(json::from_bjdata(vM, true, false).is_discarded()); }