Skip to content

Commit d9ff51f

Browse files
committed
Char literals in C are i32, not u8
1 parent b21f470 commit d9ff51f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cpp2rust/converter/converter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,8 @@ bool Converter::VisitFloatingLiteral(clang::FloatingLiteral *expr) {
15541554
bool Converter::VisitCharacterLiteral(clang::CharacterLiteral *expr) {
15551555
std::string ch = GetEscapedCharLiteral(expr->getValue());
15561556
ch = "'" + std::move(ch) + "'";
1557-
StrCat(token::kOpenParen, ch, keyword::kAs, "u8", token::kCloseParen);
1557+
StrCat(token::kOpenParen, ch, keyword::kAs, ToStringBase(expr->getType()),
1558+
token::kCloseParen);
15581559
computed_expr_type_ = ComputedExprType::FreshValue;
15591560
return false;
15601561
}

0 commit comments

Comments
 (0)