Skip to content

Commit f65f60e

Browse files
authored
[flang] Fix -Wcharacter-conversion warnings (NFC) (#155873)
This fixes new warnings when building with Clang 21, encountered in #155627.
1 parent f474f76 commit f65f60e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

flang/lib/Evaluate/fold-implementation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ common::IfNoLvalue<std::optional<TO>, FROM> ConvertString(FROM &&s) {
17851785
if (static_cast<std::uint64_t>(*iter) > 127) {
17861786
return std::nullopt;
17871787
}
1788-
str.push_back(*iter);
1788+
str.push_back(static_cast<typename TO::value_type>(*iter));
17891789
}
17901790
return std::make_optional<TO>(std::move(str));
17911791
}

flang/lib/Parser/characters.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ RESULT DecodeString(const std::string &s, bool backslashEscapes) {
289289
DecodeCharacter<ENCODING>(p, bytes, backslashEscapes)};
290290
if (decoded.bytes > 0) {
291291
if (static_cast<std::size_t>(decoded.bytes) <= bytes) {
292-
result.append(1, decoded.codepoint);
292+
result.append(
293+
1, static_cast<typename RESULT::value_type>(decoded.codepoint));
293294
bytes -= decoded.bytes;
294295
p += decoded.bytes;
295296
continue;

0 commit comments

Comments
 (0)