diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index a788d3ec..ffd98e84 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -1594,8 +1594,12 @@ class get_locale { public: inline get_locale(bool localized, locale_ref loc) : has_locale_(localized) { - if (localized) - ::new (&locale_) std::locale(loc.template get()); + if (!localized) return; + ::new (&locale_) std::locale( +#if FMT_USE_LOCALE + loc.template get() +#endif + ); } inline ~get_locale() { if (has_locale_) locale_.~locale();