diff --git a/src/compiler/codegen_internal.h b/src/compiler/codegen_internal.h index 3694d3eef..21a6d499f 100644 --- a/src/compiler/codegen_internal.h +++ b/src/compiler/codegen_internal.h @@ -37,10 +37,12 @@ static inline Type *type_lowering(Type *type) type = type->decl->enums.type_info->type; continue; case TYPE_FUNC_PTR: - if (type->pointer->function.prototype->raw_type == type->pointer) return type; - return type_get_func_ptr(type->pointer->function.prototype->raw_type); - case TYPE_FUNC_RAW: - return type->function.prototype->raw_type; + { + Type *raw_func = type->pointer; + if (raw_func->function.prototype && raw_func->function.prototype->raw_type == raw_func) return type; + FunctionPrototype *proto = type_get_resolved_prototype(raw_func); + return type_get_func_ptr(proto->raw_type); + } case TYPE_INTERFACE: return type_any; case TYPE_ANYFAULT: