mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
36 lines
574 B
Plaintext
36 lines
574 B
Plaintext
// #target: macos-x64
|
|
module test;
|
|
macro foo(int $a, int... $i)
|
|
{
|
|
$foreach $ab : $i:
|
|
{
|
|
int x = $ab;
|
|
}
|
|
$endforeach
|
|
}
|
|
fn int main()
|
|
{
|
|
foo(3, 1, 2);
|
|
int[3] $x = { 1, 2, 3 };
|
|
foo(3, ...$x);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/* #expect: test.ll
|
|
|
|
define i32 @main() #0 {
|
|
entry:
|
|
%x = alloca i32, align 4
|
|
%x1 = alloca i32, align 4
|
|
%x2 = alloca i32, align 4
|
|
%x3 = alloca i32, align 4
|
|
%x4 = alloca i32, align 4
|
|
store i32 1, ptr %x, align 4
|
|
store i32 2, ptr %x1, align 4
|
|
store i32 1, ptr %x2, align 4
|
|
store i32 2, ptr %x3, align 4
|
|
store i32 3, ptr %x4, align 4
|
|
ret i32 0
|
|
}
|