# stage2: implement structs in the frontend · gitcafe/zig

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

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

Visibility: public

Requested revision: 8ebfdc14f68521ac129ee7d2c3f4e7250e4e7418

Requested commit: 8ebfdc14f68521ac129ee7d2c3f4e7250e4e7418

Commit: 8ebfdc14f68521ac129ee7d2c3f4e7250e4e7418

Tree: 7a20ca7752b10da7e811a52927b6d1ba0869e893

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: implement structs in the frontend

New ZIR instructions:
 * struct_decl_packed
 * struct_decl_extern

New TZIR instruction: struct_field_ptr

Introduce `Module.Struct`. It uses `Value` to store default values and
abi alignments.

Implemented Sema.analyzeStructFieldPtr and zirStructDecl.

Some stuff I changed from `@panic("TODO")` to `log.warn("TODO")`.
It's becoming more clear that we need the lazy value mechanism soon;
Type is becoming unruly, and some of these functions have too much logic
given that they don't have any context for memory management or error
reporting.

```

## Parents

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

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