Rename loc_copy to locale in locale helpers (#4876)

This commit is contained in:
Victor Zverovich 2026-08-10 09:02:04 -07:00
parent 4f645a8d5d
commit 0cf9f5c99e
2 changed files with 4 additions and 4 deletions

View File

@ -129,8 +129,8 @@ inline void fwrite_all(const void* ptr, size_t count, FILE* stream) {
template <typename Char>
FMT_FUNC auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result<Char> {
auto loc_copy = loc.get<locale>();
auto&& facet = use_facet<numpunct<Char>>(loc_copy);
auto locale = loc.get<detail::locale>(); // Workaround a gcc 14 bug (#4876).
auto&& facet = use_facet<numpunct<Char>>(locale);
auto grouping = facet.grouping();
auto thousands_sep = grouping.empty() ? Char() : facet.thousands_sep();
return {std::move(grouping), thousands_sep};

View File

@ -46,8 +46,8 @@ using format_string_char_t = typename format_string_char<S>::type;
inline auto write_loc(basic_appender<wchar_t> out, loc_value value,
const format_specs& specs, locale_ref loc) -> bool {
#if FMT_USE_LOCALE
auto loc_copy = loc.get<std::locale>();
auto& numpunct = std::use_facet<std::numpunct<wchar_t>>(loc_copy);
auto locale = loc.get<std::locale>(); // Workaround a gcc 14 bug (#4876).
auto& numpunct = std::use_facet<std::numpunct<wchar_t>>(locale);
auto separator = std::wstring();
auto grouping = numpunct.grouping();
if (!grouping.empty()) separator = std::wstring(1, numpunct.thousands_sep());