diff --git a/test/printf-test.cc b/test/printf-test.cc index b89ce17e..4f9167a4 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -338,7 +338,8 @@ void TestLength(const char *length_spec) { std::numeric_limits::min()) { TestLength(length_spec, fmt::LongLong(min) - 1); } - if (max < std::numeric_limits::max()) + fmt::ULongLong long_long_max = std::numeric_limits::max(); + if (max < 0 || static_cast(max) < long_long_max) TestLength(length_spec, fmt::LongLong(max) + 1); TestLength(length_spec, std::numeric_limits::min()); TestLength(length_spec, std::numeric_limits::max());