Fix tests and error in returning error on function name.

This commit is contained in:
Christoffer Lerno
2026-02-08 22:54:18 +01:00
parent b8ee5a4150
commit 80ad0e02ad
3 changed files with 7 additions and 3 deletions

View File

@@ -954,7 +954,7 @@ static inline bool sema_cast_ident_rvalue(SemaContext *context, Expr *expr)
switch (decl->decl_kind)
{
case DECL_FUNC:
SEMA_ERROR(expr, "A function name cannot be used as a value, did you want to pass it by pointer? If so then you need to add '&', like '&%s'.", decl->span);
SEMA_ERROR(expr, "A function name cannot be used as a value, did you want to pass it by pointer? If so then you need to add '&', like '&%s'.", decl->name);
return expr_poison(expr);
case DECL_MACRO:
SEMA_ERROR(expr, "Expected a macro followed by (...).");

View File

@@ -26,9 +26,13 @@ entry:
%x = alloca i32, align 4
%blockret = alloca i32, align 4
unreachable
after_macro: ; No predecessors!
store i32 poison, ptr %x, align 4
ret void
}
define i32 @main() #0 {
define i32 @test.main() #0 {
entry:
%x = alloca i32, align 4
%x.f = alloca i64, align 8

View File

@@ -22,7 +22,7 @@ macro test()
/* #expect: test.ll
define i32 @main() #0 {
define i32 @test.main() #0 {
entry:
%temp_err = alloca i64, align 8
%len = alloca i64, align 8