mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-15 23:54:07 +00:00
Fix alias handling of procedures
An incorrect memmove when overriding entities caused multiple ones to point to the same procedure with incomplete variant data, resulting in later hiting a compiler assertion. Introduced delayed type checking for procedure aliases, as it was masked by the previous error in the override logic.
This commit is contained in:
@@ -180,6 +180,8 @@ gb_internal void override_entity_in_scope(Entity *original_entity, Entity *new_e
|
||||
|
||||
original_entity->flags |= EntityFlag_Overridden;
|
||||
original_entity->type = new_entity->type;
|
||||
original_entity->kind = new_entity->kind;
|
||||
original_entity->decl_info = new_entity->decl_info;
|
||||
original_entity->aliased_of = new_entity;
|
||||
|
||||
original_entity->identifier.store(new_entity->identifier);
|
||||
@@ -193,7 +195,7 @@ gb_internal void override_entity_in_scope(Entity *original_entity, Entity *new_e
|
||||
// This is most likely NEVER required, but it does not at all hurt to keep
|
||||
isize offset = cast(u8 *)&original_entity->Dummy.start - cast(u8 *)original_entity;
|
||||
isize size = gb_size_of(*original_entity) - offset;
|
||||
gb_memmove(cast(u8 *)original_entity, cast(u8 *)new_entity, size);
|
||||
gb_memmove(cast(u8 *)original_entity + offset, cast(u8 *)new_entity + offset, size);
|
||||
}
|
||||
|
||||
gb_internal bool check_override_as_type_due_to_aliasing(CheckerContext *ctx, Entity *e, Entity *entity, Ast *init, Type *named_type) {
|
||||
|
||||
Reference in New Issue
Block a user