mirror of
https://github.com/fmtlib/fmt.git
synced 2025-08-01 03:34:45 +02:00
Fix format_string_checker initialisation order (#3542)
Linter (clang-tidy) complains about uninitialised fields in format_string_checker since types_ is passed to context_ before being initialised. Fixes #3541.
This commit is contained in:
@@ -2599,15 +2599,15 @@ template <typename Char, typename... Args> class format_string_checker {
|
|||||||
// needed for compile-time checks: https://godbolt.org/z/GvWzcTjh1.
|
// needed for compile-time checks: https://godbolt.org/z/GvWzcTjh1.
|
||||||
using parse_func = const Char* (*)(parse_context_type&);
|
using parse_func = const Char* (*)(parse_context_type&);
|
||||||
|
|
||||||
|
type types_[num_args > 0 ? static_cast<size_t>(num_args) : 1];
|
||||||
parse_context_type context_;
|
parse_context_type context_;
|
||||||
parse_func parse_funcs_[num_args > 0 ? static_cast<size_t>(num_args) : 1];
|
parse_func parse_funcs_[num_args > 0 ? static_cast<size_t>(num_args) : 1];
|
||||||
type types_[num_args > 0 ? static_cast<size_t>(num_args) : 1];
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FMT_CONSTEXPR format_string_checker(basic_string_view<Char> fmt)
|
explicit FMT_CONSTEXPR format_string_checker(basic_string_view<Char> fmt)
|
||||||
: context_(fmt, num_args, types_),
|
: types_{mapped_type_constant<Args, buffer_context<Char>>::value...},
|
||||||
parse_funcs_{&parse_format_specs<Args, parse_context_type>...},
|
context_(fmt, num_args, types_),
|
||||||
types_{mapped_type_constant<Args, buffer_context<Char>>::value...} {}
|
parse_funcs_{&parse_format_specs<Args, parse_context_type>...} {}
|
||||||
|
|
||||||
FMT_CONSTEXPR void on_text(const Char*, const Char*) {}
|
FMT_CONSTEXPR void on_text(const Char*, const Char*) {}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user