diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 4aef96fe..91f6151c 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -451,16 +451,17 @@ FMT_END_DETAIL_NAMESPACE template struct formatter, Char> : formatter { + FMT_CONSTEXPR formatter() { + this->specs = {default_spec, 17}; + } + template FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) { auto it = ctx.begin(); if (it != ctx.end() && *it == ':') ++it; auto end = it; while (end != ctx.end() && *end != '}') ++end; - if (end == it) - this->specs = {default_spec, 17}; - else - this->specs = {it, detail::to_unsigned(end - it)}; + if (end != it) this->specs = {it, detail::to_unsigned(end - it)}; return end; }