# stage2: \`Type.hasCodeGenBits\` asserts structs and unions have fields · gitcafe/zig

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

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

Visibility: public

Requested revision: cc937369fb8fed44e8e1b653f1f22805c84a3507

Requested commit: cc937369fb8fed44e8e1b653f1f22805c84a3507

Commit: cc937369fb8fed44e8e1b653f1f22805c84a3507

Tree: 70a851043cc1a3ca4c5ff93512f988388ed63e43

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: `Type.hasCodeGenBits` asserts structs and unions have fields

Previously, this function would return an incorrect result for structs
and unions which did not have their fields resolved yet.

This required introducing more logic in Sema to resolve types before
doing certain things such as creating an anonmyous Decl and emitting
function call AIR.

As a result a couple more struct tests pass.

Oh, and I implemented the language change to make sizeOf for pointers
always return pointer size bytes even if the element type is 0 bits.

```

## Parents

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

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