File tree Expand file tree Collapse file tree
cpp2rust/converter/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1263,6 +1263,7 @@ void ConverterRefCount::ConvertFunctionToFunctionPointer(
12631263 ConvertFunctionPointerType (
12641264 fn_decl->getType ()->getAs <clang::FunctionProtoType>()),
12651265 Mapper::MapFunctionName (fn_decl)));
1266+ computed_expr_type_ = ComputedExprType::FreshPointer;
12661267}
12671268
12681269void ConverterRefCount::ConvertEqualsNullPtr (clang::Expr *expr) {
@@ -1322,7 +1323,7 @@ bool ConverterRefCount::VisitExplicitCastExpr(clang::ExplicitCastExpr *expr) {
13221323 if (expr->getTypeAsWritten ()->isVoidType ()) {
13231324 PushExprKind push (*this , ExprKind::Void);
13241325 Convert (expr->getSubExpr ());
1325- if (!TypeIsCopyable (expr->getSubExpr ()->getType ())) {
1326+ if (!TypeIsCopyable (expr->getSubExpr ()->getType ()) && ! isFresh () ) {
13261327 StrCat (" .clone()" );
13271328 }
13281329 return false ;
Original file line number Diff line number Diff line change @@ -104,11 +104,11 @@ fn main_0() -> i32 {
104104 } ) ) ;
105105 assert ! ( ( ( * err. borrow( ) ) == 7 ) ) ;
106106 assert ! ( ( ( * chosen. borrow( ) ) == 123 ) ) ;
107- bump_and_return_4. clone ( ) ;
107+ bump_and_return_4;
108108 assert ! ( ( ( * side_effect_counter_3. with( Value :: clone) . borrow( ) ) == 2 ) ) ;
109- ( FnPtr :: < fn ( ) -> i32 > :: new ( bump_and_return_4) ) . clone ( ) ;
109+ ( FnPtr :: < fn ( ) -> i32 > :: new ( bump_and_return_4) ) ;
110110 assert ! ( ( ( * side_effect_counter_3. with( Value :: clone) . borrow( ) ) == 2 ) ) ;
111- ( ( FnPtr :: < fn ( ) -> i32 > :: new ( bump_and_return_4) ) . cast :: < fn ( ) -> i32 > ( None ) ) . clone ( ) ;
111+ ( ( FnPtr :: < fn ( ) -> i32 > :: new ( bump_and_return_4) ) . cast :: < fn ( ) -> i32 > ( None ) ) ;
112112 assert ! ( ( ( * side_effect_counter_3. with( Value :: clone) . borrow( ) ) == 2 ) ) ;
113113 let storage: Value < i32 > = Rc :: new ( RefCell :: new ( 11 ) ) ;
114114 let p: Value < Ptr < i32 > > = Rc :: new ( RefCell :: new ( ( storage. as_pointer ( ) ) ) ) ;
You can’t perform that action at this time.
0 commit comments