diff --git a/include/fmt/core.h b/include/fmt/core.h index 9b7fac85..4d50d383 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1765,7 +1765,7 @@ class format_arg_store { private: static const size_t num_args = sizeof...(Args); - static const size_t num_named_args = detail::count_named_args(); + static constexpr size_t num_named_args = detail::count_named_args(); static const bool is_packed = num_args <= detail::max_packed_args; using value_type = conditional_t, @@ -1792,7 +1792,8 @@ class format_arg_store basic_format_args(*this), #endif data_{detail::make_arg(args)...} { - detail::init_named_args(data_.named_args(), 0, 0, args...); + if (num_named_args != 0) + detail::init_named_args(data_.named_args(), 0, 0, args...); } };