Skip to content

Commit 2988e46

Browse files
committed
Add full function type when converting FnPtr::null
1 parent ed3c7bf commit 2988e46

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎cpp2rust/converter/models/converter_refcount.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1966,7 +1966,10 @@ std::string ConverterRefCount::GetDefaultAsString(clang::QualType qual_type) {
19661966
if (qual_type->isPointerType()) {
19671967
auto pointee_type = qual_type->getPointeeType();
19681968
if (pointee_type->isFunctionType()) {
1969-
ret = "FnPtr::null()";
1969+
auto *proto = pointee_type->getAs<clang::FunctionProtoType>();
1970+
assert(proto && "Function pointer default without a prototype");
1971+
ret =
1972+
std::format("FnPtr::<{}>::null()", ConvertFunctionPointerType(proto));
19701973
} else {
19711974
if (pointee_type->isVoidType()) {
19721975
ret = "AnyPtr::default()";

0 commit comments

Comments
 (0)