Fixed regression compiler crash when using && for untyped parameters #2197.

This commit is contained in:
Christoffer Lerno
2025-06-10 16:26:08 +02:00
parent bbd9f6dc96
commit 1aacb1fa60
2 changed files with 19 additions and 1 deletions

View File

@@ -11094,7 +11094,7 @@ RETRY:
if (!sema_expr_analyse_ct_arg(context, to, expr)) return expr_poison(expr);
break;
case EXPR_UNARY:
if (expr->unary_expr.operator == UNARYOP_TADDR && to->canonical->type_kind == TYPE_POINTER && to->canonical != type_voidptr)
if (to && expr->unary_expr.operator == UNARYOP_TADDR && to->canonical->type_kind == TYPE_POINTER && to->canonical != type_voidptr)
{
if (!sema_analyse_inferred_expr(context, type_get_indexed_type(to), expr->unary_expr.expr)) return expr_poison(expr);
}

View File

@@ -0,0 +1,18 @@
// #target: macos-x64
module test;
macro foo(x) { return x; }
fn void main()
{
int* x = foo(&&1);
}
/* #expect: test.ll
define void @test.main() #0 {
entry:
%x = alloca ptr, align 8
%taddr = alloca i32, align 4
store i32 1, ptr %taddr, align 4
store ptr %taddr, ptr %x, align 8
ret void
}