# better handling of arrays in packed structs · gitcafe/zig

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

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

Visibility: public

Requested revision: 1066004b79d014b4c3d10da19c84c679e21b88e5

Requested commit: 1066004b79d014b4c3d10da19c84c679e21b88e5

Commit: 1066004b79d014b4c3d10da19c84c679e21b88e5

Tree: db8c1c83788a624d1fab720073255e8c556d59a0

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
better handling of arrays in packed structs

 * Separate LoadPtr IR instructions into pass1 and pass2 variants.
 * Define `type_size_bits` for extern structs to be the same as
   their `@sizeOf(T) * 8` and allow them in packed structs.
 * More helpful error messages when trying to use types in
   packed structs that are not allowed.
 * Support arrays in packed structs even when they are not
   byte-aligned.
 * Add compile error for using arrays in packed structs when the
   padding bits would be problematic. This is necessary since
   we do not have packed arrays.

closes #677

```

## Parents

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

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