Files
c3c/test/test_suite/functions/deferred_default_arguments.c3t
Christoffer Lerno e605a21fd3 Revert "Revert 0.7.6 code for 0.7.5 re-release"
This reverts commit d1349c9cfb.
2025-09-05 23:30:35 +02:00

56 lines
961 B
Plaintext

// #target: macos-x64
module test;
import std::io;
import test2;
fn void test(int a = test2::bar(), int b = test2::foo())
{
io::printf("%d %d\n", a, b);
}
module test2;
fn int foo()
{
static int x = 0;
return ++x;
}
macro int bar()
{
static int x = 0;
return ++x;
}
module test3;
import test;
import std::io;
fn void main()
{
test::test(1, 2);
test::test(a: 3);
test::test(1, b: 32);
test::test();
test::test();
}
/* #expect: test3.ll
entry:
call void @test.test(i32 1, i32 2)
%0 = call i32 @test2.foo()
call void @test.test(i32 3, i32 %0)
call void @test.test(i32 1, i32 32)
%1 = load i32, ptr @main.x, align 4
%add = add i32 %1, 1
store i32 %add, ptr @main.x, align 4
%2 = call i32 @test2.foo()
call void @test.test(i32 %add, i32 %2)
%3 = load i32, ptr @main.x.1, align 4
%add1 = add i32 %3, 1
store i32 %add1, ptr @main.x.1, align 4
%4 = call i32 @test2.foo()
call void @test.test(i32 %add1, i32 %4)
ret void
}