Skip to content

Commit

Permalink
Fix conversion warning in filesystem::path formatter (#3806)
Browse files Browse the repository at this point in the history
* Fix conversion warning in filesystem::path formatter

Use template character type to eliminate MSVC conversion warning when
formatting a wide chararacter path:

fmt\std.h(140,49): warning C4244: '=': conversion from 'const Char' to 'char', possible loss of data

* Review: use to_ascii instead

---------

Co-authored-by: Hans-Martin B. Jensen <[email protected]>
  • Loading branch information
hmbj and Hans-Martin B. Jensen authored Jan 13, 2024
1 parent 1b55d10 commit 7c163ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/fmt/std.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ template <typename Char> struct formatter<std::filesystem::path, Char> {
debug_ = true;
++it;
}
if (it != end && (*it == 'g')) path_type_ = *it++;
if (it != end && (*it == 'g')) path_type_ = detail::to_ascii(*it++);
return it;
}

Expand Down

0 comments on commit 7c163ac

Please sign in to comment.