mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
44 lines
621 B
C
44 lines
621 B
C
// #target: macos-x64
|
|
module test;
|
|
|
|
union Test @align(16)
|
|
{
|
|
char foo;
|
|
}
|
|
|
|
union Test3
|
|
{
|
|
Test test;
|
|
ulong a @align(32);
|
|
}
|
|
|
|
struct Test2
|
|
{
|
|
Test test;
|
|
uint a;
|
|
}
|
|
|
|
fn int main()
|
|
{
|
|
Test2 a;
|
|
Test b;
|
|
Test3 c;
|
|
$assert(32 == Test3.sizeof);
|
|
$assert(32 == Test3.alignof);
|
|
$assert(32 == Test2.sizeof);
|
|
$assert(16 == Test2.alignof);
|
|
$assert(16 == Test.sizeof);
|
|
$assert(16 == Test.alignof);
|
|
return 0;
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
%Test2 = type { %Test, i32, [12 x i8] }
|
|
%Test = type { i8, [15 x i8] }
|
|
%Test3 = type { i64, [24 x i8] }
|
|
|
|
%a = alloca %Test2, align 16
|
|
%b = alloca %Test, align 16
|
|
%c = alloca %Test3, align 32
|