Address MSVC C4127 warning when formatting non unicode tm (#4299)

Use `const_check` to silence visual studio's W4 level diagnostic regarding conditional expressions being constants, addresses https://github.com/fmtlib/fmt/issues/4294
This commit is contained in:
Edoardo Lolletti
2025-01-08 23:21:48 +01:00
committed by GitHub
parent 093b39ca5e
commit 3f864a4505

View File

@ -364,7 +364,7 @@ void write_codecvt(codecvt_result<CodeUnit>& out, string_view in,
template <typename OutputIt>
auto write_encoded_tm_str(OutputIt out, string_view in, const std::locale& loc)
-> OutputIt {
if (detail::use_utf8 && loc != get_classic_locale()) {
if (const_check(detail::use_utf8) && loc != get_classic_locale()) {
// char16_t and char32_t codecvts are broken in MSVC (linkage errors) and
// gcc-4.
#if FMT_MSC_VERSION != 0 || \