diff --git a/format.h b/format.h index b45656bc..a0101be1 100644 --- a/format.h +++ b/format.h @@ -3383,7 +3383,9 @@ int parse_nonnegative_int(const Char *&s) { } value = new_value; } while ('0' <= *s && *s <= '9'); - if (value > (std::numeric_limits::max)()) + // Convert to unsigned to prevent a warning. + unsigned max_int = (std::numeric_limits::max)(); + if (value > max_int) FMT_THROW(FormatError("number is too big")); return value; }