Skip to content

Commit a031ed1

Browse files
committed
Fix Ptr cast
1 parent bd0a13b commit a031ed1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎cpp2rust/converter/models/converter_refcount.cpp‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,12 @@ bool ConverterRefCount::VisitImplicitCastExpr(clang::ImplicitCastExpr *expr) {
15341534
PushParen paren(*this);
15351535
StrCat(ConvertPointer(sub_expr));
15361536
if (!IsReferenceType(sub_expr)) {
1537-
StrCat(keyword::kAs, ToString(expr->getType()));
1537+
StrCat(keyword::kAs);
1538+
if (expr->getType()->getPointeeType()->isBuiltinType()) {
1539+
StrCat(std::format("Ptr::<{}>", ConvertPointeeType(expr->getType())));
1540+
} else {
1541+
StrCat(ToString(expr->getType()));
1542+
}
15381543
}
15391544
return false;
15401545
}

0 commit comments

Comments
 (0)