From 0cf9f5c99e99d029aa252f9fd61d5ab2d3f84ecd Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 10 Aug 2026 09:02:04 -0700 Subject: [PATCH] Rename loc_copy to locale in locale helpers (#4876) --- include/fmt/format-inl.h | 4 ++-- include/fmt/xchar.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index bb3f7ea6..740ec21b 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -129,8 +129,8 @@ inline void fwrite_all(const void* ptr, size_t count, FILE* stream) { template FMT_FUNC auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result { - auto loc_copy = loc.get(); - auto&& facet = use_facet>(loc_copy); + auto locale = loc.get(); // Workaround a gcc 14 bug (#4876). + auto&& facet = use_facet>(locale); auto grouping = facet.grouping(); auto thousands_sep = grouping.empty() ? Char() : facet.thousands_sep(); return {std::move(grouping), thousands_sep}; diff --git a/include/fmt/xchar.h b/include/fmt/xchar.h index aae2a9c9..69e47db2 100644 --- a/include/fmt/xchar.h +++ b/include/fmt/xchar.h @@ -46,8 +46,8 @@ using format_string_char_t = typename format_string_char::type; inline auto write_loc(basic_appender out, loc_value value, const format_specs& specs, locale_ref loc) -> bool { #if FMT_USE_LOCALE - auto loc_copy = loc.get(); - auto& numpunct = std::use_facet>(loc_copy); + auto locale = loc.get(); // Workaround a gcc 14 bug (#4876). + auto& numpunct = std::use_facet>(locale); auto separator = std::wstring(); auto grouping = numpunct.grouping(); if (!grouping.empty()) separator = std::wstring(1, numpunct.thousands_sep());