Skip to content

Commit

Permalink
Fix narrowing conversion warning in struct fstring (#4210)
Browse files Browse the repository at this point in the history
Warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data.
  • Loading branch information
sergio-nsk authored Oct 27, 2024
1 parent 168df9a commit 68f3153
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -2658,12 +2658,14 @@ inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; }
/// A compile-time format string.
template <typename... T> struct fstring {
private:
static constexpr int num_static_named_args =
static constexpr size_t num_static_named_args =
detail::count_static_named_args<T...>();

using checker = detail::format_string_checker<
char, static_cast<int>(sizeof...(T)), num_static_named_args,
num_static_named_args != detail::count_named_args<T...>()>;
using checker =
detail::format_string_checker<char, static_cast<int>(sizeof...(T)),
static_cast<int>(num_static_named_args),
num_static_named_args !=
detail::count_named_args<T...>()>;

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

Expand Down

0 comments on commit 68f3153

Please sign in to comment.