Files
c3c/test/test_suite/struct/struct_const_construct_simple.c3t
2021-05-27 08:30:02 +02:00

34 lines
911 B
Plaintext

module structo;
struct Foo
{
int foo;
long bar;
}
usize x = Foo.sizeof;
Foo foo1 = { 1, 2 };
Foo foo2 = { .foo = 2 };
Foo foo3 = { .bar = 3 };
Foo foo4 = { .bar = 4, .foo = 4, .bar = 1 };
Foo foo5 = {};
Foo foo6;
const Foo FOO7 = { 1, 2 };
Foo foo8 = FOO7;
// #expect: structo.ll
%Foo = type { i32, i64 }
@Foo = linkonce_odr constant i8 1
@structo.x = protected global i64 16, align 8
@structo.foo1 = protected global %Foo { i32 1, i64 2 }, align 8
@structo.foo2 = protected global %Foo { i32 2, i64 0 }, align 8
@structo.foo3 = protected global %Foo { i32 0, i64 3 }, align 8
@structo.foo4 = protected global %Foo { i32 4, i64 1 }, align 8
@structo.foo5 = protected global %Foo zeroinitializer, align 8
@structo.foo6 = protected global %Foo zeroinitializer, align 8
@structo.FOO7 = protected constant %Foo { i32 1, i64 2 }, align 8
@structo.foo8 = protected global %Foo { i32 1, i64 2 }, align 8