-disallow-non-constant-globals

This commit is contained in:
gingerBill
2026-05-04 11:28:57 +01:00
parent 83dab63dcd
commit cdc0efce43
3 changed files with 12 additions and 0 deletions

View File

@@ -2071,6 +2071,10 @@ gb_internal bool lb_init_global_var(lbModule *m, lbProcedure *p, Entity *e, Ast
}
var.is_initialized = true;
if (build_context.disable_non_constant_globals) {
error(e->token, "Non-constant initialization of a global variable is disallowed with '-disable_non_constant_globals'");
}
}
return false;
}