From ffb0f2b440ed080f8b7191b4887d94f09cb3c592 Mon Sep 17 00:00:00 2001 From: Sergey Markelov Date: Mon, 21 Oct 2024 10:00:31 -0700 Subject: [PATCH] Fix narrowing conversion warning in struct fstring Warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data. Client applications fail to compile if warnings are treated as errors. --- 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 e0baae256347..663edd971b49 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -2634,12 +2634,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;