From 4d02ce44146e8a1b0f1af9f9fd7a71d383fdc773 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 27 Jan 2026 23:43:14 +0100 Subject: [PATCH] Additional fix for #2853 --- src/compiler/sema_expr.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 7292bd696..5645fe5eb 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -10938,6 +10938,12 @@ static inline bool sema_expr_analyse_lambda(SemaContext *context, Type *target_t // so we'll declare it as weak and externally visible. unit_register_external_symbol(context, decl); + if (context->generic_instance) + { + decl->is_templated = true; + decl->instance_id = declid(context->generic_instance); + } + // Before function analysis, lambda evaluation is deferred if (unit->module->stage < ANALYSIS_FUNCTIONS) { @@ -10947,11 +10953,6 @@ static inline bool sema_expr_analyse_lambda(SemaContext *context, Type *target_t decl->var.is_read = true; } decl_flatten(decl)->is_external_visible = true; - if (context->generic_instance) - { - decl->is_templated = true; - decl->instance_id = declid(context->generic_instance); - } vec_add(unit->module->lambdas_to_evaluate, decl); } else