From ec0bd121db9b01d5906f03171ecb40dd8fd7401b Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Thu, 17 Sep 2026 16:20:11 +0200 Subject: [PATCH] Fix redecleration error for globals --- src/check_decl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 49d695c8a..50a4a7bee 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -1778,7 +1778,8 @@ gb_internal void check_global_variable_decl(CheckerContext *ctx, Entity *e, Ast TokenPos pos = f->token.pos; Type *this_type = base_type(e->type); Type *other_type = base_type(f->type); - if (!signature_parameter_similar_enough(this_type, other_type)) { + bool type_is_null = (e->type == nullptr || f->type == nullptr); + if (type_is_null || !signature_parameter_similar_enough(this_type, other_type)) { error(e->token, "Foreign entity '%.*s' previously declared elsewhere with a different type\n" "\tat %s",