mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Fixed regression compiler crash when using && for untyped parameters #2197.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
18
test/test_suite/macros/untyped_arg_inference.c3t
Normal file
18
test/test_suite/macros/untyped_arg_inference.c3t
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user