Skip to content

Commit 7cf4302

Browse files
committed
Pass through no-op casts to records
1 parent 3f1c7fe commit 7cf4302

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎cpp2rust/converter/converter.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2736,7 +2736,8 @@ bool Converter::VisitExplicitCastExpr(clang::ExplicitCastExpr *expr) {
27362736
case clang::Stmt::CXXReinterpretCastExprClass:
27372737
case clang::Stmt::CXXStaticCastExprClass:
27382738
case clang::Stmt::CStyleCastExprClass:
2739-
if (expr->getType() == sub_expr->getType()) {
2739+
if (expr->getType() == sub_expr->getType() ||
2740+
(expr->getCastKind() == clang::CK_NoOp && type->isRecordType())) {
27402741
return Convert(sub_expr);
27412742
}
27422743
if (type->isFunctionPointerType() ||

‎rules/fs_path/tgt_refcount.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ fn f1(a0: Ptr<i8>) -> Vec<i8> {
1515
}
1616

1717
fn f2(a0: Vec<i8>) -> Vec<i8> {
18-
a0.clone()
18+
a0
1919
}

0 commit comments

Comments
 (0)