mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
32 lines
441 B
C
32 lines
441 B
C
module test;
|
|
|
|
union UnionB
|
|
{
|
|
struct b
|
|
{
|
|
int a;
|
|
}
|
|
int c;
|
|
double d;
|
|
}
|
|
|
|
extern func int bar();
|
|
|
|
func void test()
|
|
{
|
|
UnionB b = { .c = bar(), .b = {} };
|
|
}
|
|
|
|
// #expect: test.ll
|
|
|
|
entry:
|
|
%b = alloca %UnionB, align 8
|
|
%0 = bitcast %UnionB* %b to i32*
|
|
%1 = call i32 @bar()
|
|
store i32 %1, i32* %0, align 8
|
|
%2 = bitcast %UnionB* %b to %b*
|
|
%3 = bitcast %b* %2 to i32*
|
|
store i32 0, i32* %3, align 8
|
|
ret void
|
|
|