From b86932c03c51efbb6c6146f8c91dd03bf82ab226 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Fri, 8 Aug 2025 12:21:50 +0100 Subject: Disallow `proc "odin"` procedures to be called in the global scope in variable declarations --- src/check_decl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/check_decl.cpp b/src/check_decl.cpp index af46ee40e..ee7906e5e 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -1851,6 +1851,12 @@ gb_internal void check_entity_decl(CheckerContext *ctx, Entity *e, DeclInfo *d, c.scope = d->scope; c.decl = d; c.type_level = 0; + c.curr_proc_calling_convention = ProcCC_Contextless; + + auto prev_flags = c.scope->flags; + defer (c.scope->flags = prev_flags); + c.scope->flags &= ~ScopeFlag_ContextDefined; + e->parent_proc_decl = c.curr_proc_decl; e->state = EntityState_InProgress; -- cgit v1.2.3