Skip to content

Commit

Permalink
gcc: fix -Wnvro warning
Browse files Browse the repository at this point in the history
Allows the copiler to elide the copy.

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Dec 5, 2024
1 parent 47a66c5 commit 2c45b41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -1718,8 +1718,9 @@ auto find_escape(const Char* begin, const Char* end)

inline auto find_escape(const char* begin, const char* end)
-> find_escape_result<char> {
if (const_check(!use_utf8)) return find_escape<char>(begin, end);
auto result = find_escape_result<char>{end, nullptr, 0};
auto result = find_escape<char>(begin, end);
if (const_check(!use_utf8)) return result;
result = find_escape_result<char>{end, nullptr, 0};
for_each_codepoint(string_view(begin, to_unsigned(end - begin)),
[&](uint32_t cp, string_view sv) {
if (needs_escape(cp)) {
Expand Down

0 comments on commit 2c45b41

Please sign in to comment.