Skip to content

Commit 285428f

Browse files
committed
Don't clone on void expression
1 parent 5c99fd1 commit 285428f

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎cpp2rust/converter/models/converter_refcount.cpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,11 +1341,10 @@ bool ConverterRefCount::VisitFunctionPointerCast(
13411341

13421342
bool ConverterRefCount::VisitExplicitCastExpr(clang::ExplicitCastExpr *expr) {
13431343
if (expr->getTypeAsWritten()->isVoidType()) {
1344+
StrCat(token::kRef);
1345+
PushParen paren(*this);
13441346
PushExprKind push(*this, ExprKind::Void);
13451347
Convert(expr->getSubExpr());
1346-
if (!TypeIsCopyable(expr->getSubExpr()->getType()) && !isFresh()) {
1347-
StrCat(".clone()");
1348-
}
13491348
return false;
13501349
}
13511350
if (expr->getCastKind() == clang::CK_NullToPointer) {

0 commit comments

Comments
 (0)