Skip to content

Commit

Permalink
Address MSVC C4127 warning when formatting non unicode tm (#4299)
Browse files Browse the repository at this point in the history
Use `const_check` to silence visual studio's W4 level diagnostic regarding conditional expressions being constants, addresses #4294
  • Loading branch information
edo9300 authored Jan 8, 2025
1 parent 093b39c commit 3f864a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 || \
Expand Down

0 comments on commit 3f864a4

Please sign in to comment.