diff --git a/include/fmt/format.h b/include/fmt/format.h index 108307eb..31d08be7 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -553,7 +553,8 @@ FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T& value) template FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { if (is_constant_evaluated()) return fill_n(out, count, value); - std::memset(out, value, to_unsigned(count) * sizeof(T)); + static_assert(1 == sizeof(T), "sizeof(T) must be 1 to use char for initialization"); + std::memset(out, value, to_unsigned(count)); return out + count; } @@ -2799,7 +2800,7 @@ class bigint { bigits_.resize(to_unsigned(num_bigits + exp_difference)); for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j) bigits_[j] = bigits_[i]; - fill_n(bigits_.data(), to_unsigned(exp_difference), 0); + fill_n(bigits_.data(), to_unsigned(exp_difference), 0U); exp_ -= exp_difference; }