Bug using #foo arguments with $defined #2173

This commit is contained in:
Christoffer Lerno
2025-05-31 17:35:29 +02:00
parent 18e408ead4
commit c3d2b2824c
3 changed files with 13 additions and 2 deletions

View File

@@ -58,6 +58,7 @@
- Check pointer/slice/etc on `[out]` and `&` params. #2156.
- Compiler didn't check foreach over flexible array member, and folding a flexible array member was allowed #2164.
- Too strict project view #2163.
- Bug using `#foo` arguments with `$defined` #2173
### Stdlib changes
- Added `String.quick_ztr` and `String.is_zstr`

View File

@@ -9661,10 +9661,10 @@ static inline bool sema_expr_analyse_ct_defined(SemaContext *context, Expr *expr
{
case EXPR_OTHER_CONTEXT:
active_context->call_env.in_no_eval = in_no_eval;
active_context = expr->expr_other_context.context;
active_context = main_expr->expr_other_context.context;
in_no_eval = active_context->call_env.in_no_eval;
active_context->call_env.in_no_eval = true;
main_expr = expr->expr_other_context.inner;
main_expr = main_expr->expr_other_context.inner;
goto RETRY;
case EXPR_ACCESS_UNRESOLVED:
if (!sema_expr_analyse_access(active_context, main_expr, &failed, CHECK_VALUE, false))

View File

@@ -0,0 +1,10 @@
macro @test(#a)
{
$defined(#a);
}
fn int main()
{
@test(0);
return 0;
}