From 68f3153762de6c30d47e5760a057827f58bcdc20 Mon Sep 17 00:00:00 2001 From: Sergey Date: Sun, 27 Oct 2024 06:41:20 -0700 Subject: [PATCH] Fix narrowing conversion warning in struct fstring (#4210) Warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data. --- include/fmt/base.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index 169b08619c90..a8938e49aebd 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -2658,12 +2658,14 @@ inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; } /// A compile-time format string. template struct fstring { private: - static constexpr int num_static_named_args = + static constexpr size_t num_static_named_args = detail::count_static_named_args(); - using checker = detail::format_string_checker< - char, static_cast(sizeof...(T)), num_static_named_args, - num_static_named_args != detail::count_named_args()>; + using checker = + detail::format_string_checker(sizeof...(T)), + static_cast(num_static_named_args), + num_static_named_args != + detail::count_named_args()>; using arg_pack = detail::arg_pack;