Files
c3c/test/test_suite/enumerations/enum_add_sub.c3t
Christoffer Lerno 5c77c9a754 - Change distinct -> typedef.
- Order of attribute declaration is changed for `alias`.
- Added `LANGUAGE_DEV_VERSION` env constant.
- Rename `anyfault` -> `fault`.
- Changed `fault` -> `faultdef`.
- Added `attrdef` instead of `alias` for attribute aliases.
2025-03-15 20:10:47 +01:00

49 lines
964 B
Plaintext

// #target: macos-x64
module test;
enum Foo
{
ABC
}
typedef Abc = inline Foo;
typedef BarInt = int;
enum Bar : BarInt
{
ABC
}
fn int main()
{
Foo a;
a += 1;
$assert $typeof(a++).typeid == Foo.typeid;
$assert $typeof(a += 1).typeid == Foo.typeid;
Abc b;
b += 1;
$assert $typeof(b++).typeid == Abc.typeid;
$assert $typeof(b += 1).typeid == Abc.typeid;
Bar c;
c += 1;
$assert $typeof(c++).typeid == Bar.typeid;
$assert $typeof(c += 1).typeid == Bar.typeid;
return 0;
}
/* #expect: test.ll
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
store i32 0, ptr %a, align 4
%0 = load i32, ptr %a, align 4
%add = add i32 %0, 1
store i32 %add, ptr %a, align 4
store i32 0, ptr %b, align 4
%1 = load i32, ptr %b, align 4
%add1 = add i32 %1, 1
store i32 %add1, ptr %b, align 4
store i32 0, ptr %c, align 4
%2 = load i32, ptr %c, align 4
%add2 = add i32 %2, 1
store i32 %add2, ptr %c, align 4
ret i32 0