# stage2: Add hasWellDefinedLayout\(\) to type.zig and Sema.zig · gitcafe/zig

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

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

Visibility: public

Requested revision: 34a6fcd88e20a2491bf6a5396d583a7449cac20b

Requested commit: 34a6fcd88e20a2491bf6a5396d583a7449cac20b

Commit: 34a6fcd88e20a2491bf6a5396d583a7449cac20b

Tree: 02eba522b43876b9145d8369332557d47d3f25c5

Author: Cody Tapscott

Committer: Andrew Kelley

## Message

```
stage2: Add hasWellDefinedLayout() to type.zig and Sema.zig

This follows the same strategy as sema.typeRequiresComptime() and
type.comptimeOnly(): Two versions of the function, one which performs
resolution just-in-time and another which asserts that resolution is
complete.

Thankfully, this doesn't cause very viral type resolution, since
auto-layout structs and unions are very common and are known to not have
a well-defined layout without resolving their fields.

```

## Parents

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

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