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