Skip to content

Commit ffb0f2b

Browse files
committed
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.
1 parent e9eaa27 commit ffb0f2b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

include/fmt/base.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -2634,12 +2634,14 @@ inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; }
26342634
/// A compile-time format string.
26352635
template <typename... T> struct fstring {
26362636
private:
2637-
static constexpr int num_static_named_args =
2637+
static constexpr size_t num_static_named_args =
26382638
detail::count_static_named_args<T...>();
26392639

2640-
using checker = detail::format_string_checker<
2641-
char, static_cast<int>(sizeof...(T)), num_static_named_args,
2642-
num_static_named_args != detail::count_named_args<T...>()>;
2640+
using checker =
2641+
detail::format_string_checker<char, static_cast<int>(sizeof...(T)),
2642+
static_cast<int>(num_static_named_args),
2643+
num_static_named_args !=
2644+
detail::count_named_args<T...>()>;
26432645

26442646
using arg_pack = detail::arg_pack<T...>;
26452647

0 commit comments

Comments
 (0)