mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
correct sret to use the element type and not the pointer type
This commit is contained in:
parent
b190b09b78
commit
9c35d29c24
@ -6411,8 +6411,10 @@ impl<'ctx> FunctionSpec<'ctx> {
|
||||
let sret_attribute_id = Attribute::get_named_enum_kind_id("sret");
|
||||
debug_assert!(sret_attribute_id > 0);
|
||||
let ret_typ = self.typ.get_param_types()[param_index as usize];
|
||||
// ret_typ is a pointer type. We need the base type here.
|
||||
let ret_base_typ = ret_typ.into_pointer_type().get_element_type();
|
||||
let sret_attribute =
|
||||
ctx.create_type_attribute(sret_attribute_id, ret_typ.as_any_type_enum());
|
||||
ctx.create_type_attribute(sret_attribute_id, ret_base_typ.as_any_type_enum());
|
||||
fn_val.add_attribute(AttributeLoc::Param(0), sret_attribute);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user