mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
31 lines
385 B
C
31 lines
385 B
C
// #target: macos-x64
|
|
module test;
|
|
enum Vehicles
|
|
{
|
|
CAR,
|
|
PLANE
|
|
}
|
|
|
|
macro elements($Type)
|
|
{
|
|
int x;
|
|
$foreach ($x : $Type.values):
|
|
x = (int)$x;
|
|
$endforeach;
|
|
}
|
|
|
|
fn void main()
|
|
{
|
|
elements(Vehicles);
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
entry:
|
|
%x = alloca i32, align 4
|
|
store i32 0, ptr %x, align 4
|
|
store i32 0, ptr %x, align 4
|
|
store i32 1, ptr %x, align 4
|
|
ret void
|
|
}
|