# stage2: implement \`@unionInit\` · gitcafe/zig

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

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

Visibility: public

Requested revision: 2687b8f7f4825c9018af6998e1de140e6185f9cd

Requested commit: 2687b8f7f4825c9018af6998e1de140e6185f9cd

Commit: 2687b8f7f4825c9018af6998e1de140e6185f9cd

Tree: 4bbd5f609153618e883ad4cce09c7a8c920a22b0

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: implement `@unionInit`

The ZIR instruction `union_init_ptr` is renamed to `union_init`.
I made it always use by-value semantics for now, not taking the time to
invest in result location semantics, in case we decide to change the
rules for unions. This way is much simpler.

There is a new AIR instruction: union_init. This is for a comptime known
tag, runtime-known field value.
vector_init is renamed to aggregate_init, which solves a TODO comment.

```

## Parents

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

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