diff options
| author | Roland Kovacs <zen3ger@tutanota.com> | 2024-08-11 01:09:22 +0200 |
|---|---|---|
| committer | Roland Kovacs <zen3ger@tutanota.com> | 2024-08-12 19:52:42 +0200 |
| commit | 9eb7186cda2081c7fadbc0d196346b4e57f5e4c1 (patch) | |
| tree | 45b674bc5052b9670e18f7755696348f5d35f0a0 /src/checker.cpp | |
| parent | be7a1f671c85040121fb8a96aca9c2c2b2c0fc7e (diff) | |
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.
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 60000ec29..91e7a08fe 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -5676,6 +5676,18 @@ gb_internal void check_procedure_later_from_entity(Checker *c, Entity *e, char c if ((e->flags & EntityFlag_ProcBodyChecked) != 0) { return; } + if ((e->flags & EntityFlag_Overridden) != 0) { + // NOTE (zen3ger) Delay checking of a proc alias until the underlying proc is checked. + GB_ASSERT(e->aliased_of != nullptr); + GB_ASSERT(e->aliased_of->kind == Entity_Procedure); + if ((e->aliased_of->flags & EntityFlag_ProcBodyChecked) != 0) { + e->flags |= EntityFlag_ProcBodyChecked; + return; + } + // NOTE (zen3ger) A proc alias *does not* have a body and tags! + check_procedure_later(c, e->file, e->token, e->decl_info, e->type, nullptr, 0); + return; + } Type *type = base_type(e->type); if (type == t_invalid) { return; |