diff --git a/include/fmt/format.h b/include/fmt/format.h index 8aae001a..68ae3667 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1693,9 +1693,15 @@ auto write_escaped_string(OutputIt out, basic_string_view str) -> OutputIt template auto write_escaped_char(OutputIt out, Char v) -> OutputIt { + *out++ = v; + return out; +} + +template +auto write_escaped_char(OutputIt out, char v) -> OutputIt { *out++ = '\''; - if (needs_escape(v) && v != '"' || v == '\'') { - out = write_escaped_cp(out, find_escape_result{ + if ((needs_escape(v) && v != '"') || v == '\'') { + out = write_escaped_cp(out, find_escape_result{ &v, &v+1, static_cast(v) }); } else {