diff --git a/include/fmt/format.h b/include/fmt/format.h index 30addcb7f3357..52139eec17004 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4218,12 +4218,18 @@ struct formatter> { template struct nested_formatter { private: - int width_; + int width_ = 0; detail::fill_t fill_; align_t align_ : 4; formatter formatter_; public: + // Using initialization list for 'align_' because default member initializers + // for bit-fields are C++20 + constexpr nested_formatter() noexcept( + std::is_nothrow_constructible>::value) + : align_(align_t::none) {} + FMT_CONSTEXPR auto parse(format_parse_context& ctx) -> const char* { auto specs = detail::dynamic_format_specs(); auto it = parse_format_specs(