From e2aa06cd0a289985159f775600f82fcb4e006d4a Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 18 Oct 2025 07:39:31 -0700 Subject: [PATCH] Workaround ABI incompatibility between clang ang gcc --- include/fmt/base.h | 5 ++++- src/format.cc | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index d7679757..e58a5d72 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -924,7 +924,10 @@ class locale_ref { constexpr locale_ref() : locale_(nullptr) {} template - locale_ref(const Locale& loc); + locale_ref(const Locale& loc) : locale_(&loc) { + // Check if std::isalpha is found via ADL to reduce the chance of misuse. + isalpha('x', loc); + } inline explicit operator bool() const noexcept { return locale_ != nullptr; } #endif // FMT_USE_LOCALE diff --git a/src/format.cc b/src/format.cc index 05d0105b..e583446e 100644 --- a/src/format.cc +++ b/src/format.cc @@ -10,7 +10,7 @@ FMT_BEGIN_NAMESPACE #if FMT_USE_LOCALE -template FMT_API locale_ref::locale_ref(const std::locale& loc); +template FMT_API locale_ref::locale_ref(const std::locale& loc); // DEPRECATED! template FMT_API auto locale_ref::get() const -> std::locale; #endif