Skip to content

Commit

Permalink
fix: make nested_formatter constexpr default constructible
Browse files Browse the repository at this point in the history
  • Loading branch information
muggenhor committed Sep 30, 2023
1 parent 17451c5 commit cc4409c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -4218,12 +4218,18 @@ struct formatter<nested_view<T>> {
template <typename T>
struct nested_formatter {
private:
int width_;
int width_ = 0;
detail::fill_t<char> fill_;
align_t align_ : 4;
formatter<T> 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<formatter<T>>::value)
: align_(align_t::none) {}

FMT_CONSTEXPR auto parse(format_parse_context& ctx) -> const char* {
auto specs = detail::dynamic_format_specs<char>();
auto it = parse_format_specs(
Expand Down

0 comments on commit cc4409c

Please sign in to comment.