From 651735f9a0954f8cd92c8e5340901bfc5517b8bd Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 16 Dec 2025 13:30:43 +0100 Subject: [PATCH] - `$$LINE` would sometimes incorrectly be constant. --- releasenotes.md | 1 + src/compiler/sema_expr.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/releasenotes.md b/releasenotes.md index 3704269eb..bb9ff7e9e 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -20,6 +20,7 @@ - `$defined(foo())` now correctly errors if `foo()` would require a path. - `@if($defined((char*){}.foo()))` does not error if `foo` is missing. - Hard limit of 127 characters for identifiers. +- `$$LINE` would sometimes incorrectly be constant. ### Stdlib changes - Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads. diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 985c81059..41b0a9bbc 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -1691,11 +1691,13 @@ INLINE bool sema_set_default_argument(SemaContext *context, CalledDecl *callee, SemaContext *new_context = context_transform_for_eval(context, &default_context, param->unit); bool success; SCOPE_START + uint32_t line = new_context->original_inline_line; new_context->original_inline_line = context->original_inline_line ? context->original_inline_line : call->span.row; new_context->original_module = context->original_module; success = sema_analyse_parameter(new_context, arg, param, callee->definition, optional, no_match_ref, callee->macro, false); + new_context->original_inline_line = line; SCOPE_END; sema_context_destroy(&default_context); if (no_match_ref && *no_match_ref) return true;