Assert when a macro with compile time value is discarded, e.g. foo(); where foo() returns an untyped list. #2117

This commit is contained in:
Christoffer Lerno
2025-05-02 21:16:56 +02:00
parent 8a0907cb70
commit a411f20762
3 changed files with 30 additions and 2 deletions

View File

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