Skip to content

Commit 1ed5626

Browse files
committed
Add correct cast on wide char literal
1 parent 77a16d5 commit 1ed5626

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎cpp2rust/converter/converter.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,6 +2210,13 @@ bool Converter::VisitFloatingLiteral(clang::FloatingLiteral *expr) {
22102210
}
22112211

22122212
bool Converter::VisitCharacterLiteral(clang::CharacterLiteral *expr) {
2213+
if (expr->getKind() != clang::CharacterLiteralKind::Ascii) {
2214+
PushParen paren(*this);
2215+
StrCat(std::to_string(expr->getValue()), keyword::kAs,
2216+
ToStringBase(expr->getType()));
2217+
computed_expr_type_ = ComputedExprType::FreshValue;
2218+
return false;
2219+
}
22132220
auto uc = static_cast<unsigned char>(expr->getValue());
22142221
std::string ch = GetEscapedCharLiteral(expr->getValue());
22152222
ch = (uc > 0x7F ? "b'" : "'") + std::move(ch) + '\'';

0 commit comments

Comments
 (0)