mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Adding min/max/elements to enums.
This commit is contained in:
committed by
Christoffer Lerno
parent
dbb067a005
commit
cf82140a47
20
test/test_suite/enumerations/compile_time.c3t
Normal file
20
test/test_suite/enumerations/compile_time.c3t
Normal file
@@ -0,0 +1,20 @@
|
||||
enum MyEnum : short
|
||||
{
|
||||
HELO = 12,
|
||||
WORLD = 14,
|
||||
BYE = -5
|
||||
}
|
||||
|
||||
int myenum_max = MyEnum.max;
|
||||
int myenum_min = MyEnum.min;
|
||||
int myenum_elements = MyEnum.elements;
|
||||
int myenum_alignof = MyEnum.alignof;
|
||||
int myenum_sizeof = MyEnum.sizeof;
|
||||
|
||||
// #expect: compile_time.ll
|
||||
|
||||
@compile_time.myenum_max = protected global i32 14, align 4
|
||||
@compile_time.myenum_min = protected global i32 -5, align 4
|
||||
@compile_time.myenum_elements = protected global i32 3, align 4
|
||||
@compile_time.myenum_alignof = protected global i32 2, align 4
|
||||
@compile_time.myenum_sizeof = protected global i32 2, align 4
|
||||
Reference in New Issue
Block a user