diff --git a/cpp2rust/converter/models/converter_refcount.cpp b/cpp2rust/converter/models/converter_refcount.cpp index 561bb1bb..9acd0611 100644 --- a/cpp2rust/converter/models/converter_refcount.cpp +++ b/cpp2rust/converter/models/converter_refcount.cpp @@ -1149,7 +1149,8 @@ bool ConverterRefCount::VisitExplicitCastExpr(clang::ExplicitCastExpr *expr) { case clang::Stmt::CXXStaticCastExprClass: if (!VisitFunctionPointerCast(expr)) { return false; - } else if (expr->getSubExpr()->getType()->isVoidPointerType()) { + } else if (expr->getSubExpr()->getType()->isVoidPointerType() && + expr->getType()->isPointerType()) { Convert(expr->getSubExpr()); PushConversionKind push(*this, ConversionKind::Unboxed); StrCat(std::format(".cast::<{}>().expect(\"ub:wrong type\")",