mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Unable to access fields of a const inline enum with an aggregate underlying type. #2802
This commit is contained in:
36
test/test_suite/enumerations/const_enum_inline_member.c3t
Normal file
36
test/test_suite/enumerations/const_enum_inline_member.c3t
Normal file
@@ -0,0 +1,36 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
struct Bar
|
||||
{
|
||||
uint x, y, z;
|
||||
}
|
||||
|
||||
enum Foo : const inline Bar
|
||||
{
|
||||
X = {1, 0, 0},
|
||||
Y = {0, 1, 0},
|
||||
Z = {0, 0, 1},
|
||||
}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
uint a = Foo.X.x;
|
||||
Foo b = X;
|
||||
uint c = b.y;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%a = alloca i32, align 4
|
||||
%b = alloca %Bar, align 4
|
||||
%c = alloca i32, align 4
|
||||
store i32 1, ptr %a, align 4
|
||||
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %b, ptr align 4 @.__const, i32 12, i1 false)
|
||||
%ptradd = getelementptr inbounds i8, ptr %b, i64 4
|
||||
%0 = load i32, ptr %ptradd, align 4
|
||||
store i32 %0, ptr %c, align 4
|
||||
ret i32 0
|
||||
}
|
||||
Reference in New Issue
Block a user