mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
44 lines
787 B
Plaintext
44 lines
787 B
Plaintext
// #target: macos-x64
|
|
module test;
|
|
import std;
|
|
typedef DistinctInt = inline int;
|
|
enum Foo : inline int
|
|
{
|
|
ABC,
|
|
}
|
|
constdef Bar : inline int
|
|
{
|
|
HELLO = 1
|
|
}
|
|
fn int main()
|
|
{
|
|
int a = 1;
|
|
DistinctInt b = 2;
|
|
int c = a + b;
|
|
c = a + Bar.HELLO;
|
|
c = a + Foo.ABC;
|
|
return 0;
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
|
|
define i32 @main() #0 {
|
|
entry:
|
|
%a = alloca i32, align 4
|
|
%b = alloca i32, align 4
|
|
%c = alloca i32, align 4
|
|
store i32 1, ptr %a, align 4
|
|
store i32 2, ptr %b, align 4
|
|
%0 = load i32, ptr %a, align 4
|
|
%1 = load i32, ptr %b, align 4
|
|
%add = add i32 %0, %1
|
|
store i32 %add, ptr %c, align 4
|
|
%2 = load i32, ptr %a, align 4
|
|
%add1 = add i32 %2, 1
|
|
store i32 %add1, ptr %c, align 4
|
|
%3 = load i32, ptr %a, align 4
|
|
%add2 = add i32 %3, 0
|
|
store i32 %add2, ptr %c, align 4
|
|
ret i32 0
|
|
} |