# hook up result locations for union initializations · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/1a51bf63047e9a3cd6ae3273296fded82009235c)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 1a51bf63047e9a3cd6ae3273296fded82009235c

Requested commit: 1a51bf63047e9a3cd6ae3273296fded82009235c

Commit: 1a51bf63047e9a3cd6ae3273296fded82009235c

Tree: a0ed33775740c091baad17c8dffdc5c9c272cefb

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

````
hook up result locations for union initializations

```zig
export fn entry() void {
    var x = Foo{ .bar = bar() };
}
```

```llvm
define void @entry() #2 !dbg !44 {
Entry:
  %x = alloca %Foo, align 4
  %0 = getelementptr inbounds %Foo, %Foo* %x, i32 0, i32 1, !dbg !68
  store i1 true, i1* %0, align 1, !dbg !68
  %1 = getelementptr inbounds %Foo, %Foo* %x, i32 0, i32 0, !dbg !68
  %2 = bitcast { i32, [4 x i8] }* %1 to %Bar*, !dbg !68
  call fastcc void @bar(%Bar* sret %2), !dbg !68
  call void @llvm.dbg.declare(metadata %Foo* %x, metadata !48, metadata !DIExpression()), !dbg !69
  ret void, !dbg !70
}
```

````

## Parents

- [4e2b2822f18577edb614bdc3ec6808a0587662e5](https://git.cafe/gitcafe/zig/commit/4e2b2822f18577edb614bdc3ec6808a0587662e5?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/1a51bf63047e9a3cd6ae3273296fded82009235c?format=markdown)
