mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Moved examples around. Updated (and corrected) const initialization. Removed "in" keyword. Added "member" attribute domain. Many fixes in struct padding and alignment and tests. Fixed extern global.
This commit is contained in:
committed by
Christoffer Lerno
parent
564c93700e
commit
3a24fbfa6d
33
test/test_suite/struct/struct_const_construct_simple.c3t
Normal file
33
test/test_suite/struct/struct_const_construct_simple.c3t
Normal file
@@ -0,0 +1,33 @@
|
||||
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: struct_const_construct_simple.ll
|
||||
|
||||
%structo.Foo = type { i32, i64 }
|
||||
|
||||
@Foo = linkonce_odr constant i8 1
|
||||
@x = protected global i64 16, align 8
|
||||
@foo1 = protected global %structo.Foo { i32 1, i64 2 }, align 8
|
||||
@foo2 = protected global %structo.Foo { i32 2, i64 0 }, align 8
|
||||
@foo3 = protected global %structo.Foo { i32 0, i64 3 }, align 8
|
||||
@foo4 = protected global %structo.Foo { i32 4, i64 1 }, align 8
|
||||
@foo5 = protected global %structo.Foo zeroinitializer, align 8
|
||||
@foo6 = protected global %structo.Foo zeroinitializer, align 8
|
||||
@FOO7 = protected constant %structo.Foo { i32 1, i64 2 }, align 8
|
||||
@foo8 = protected global %structo.Foo { i32 1, i64 2 }, align 8
|
||||
Reference in New Issue
Block a user