From dcea61653538ad315f6d88dda8d54697425c95d0 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 26 Sep 2025 07:48:43 -0700 Subject: [PATCH] Fix compilation with locale disabled in header-only mode --- include/fmt/chrono.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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();