# stage2: Properly "flatten" elem_ptrs before deref · gitcafe/zig

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

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

Visibility: public

Requested revision: 1c223819098e5621e2e5ad526879cd33852144e1

Requested commit: 1c223819098e5621e2e5ad526879cd33852144e1

Commit: 1c223819098e5621e2e5ad526879cd33852144e1

Tree: 1e472eb0497e45fcc3c888815cf26a0ec71f33d3

Author: Cody Tapscott

Committer: Andrew Kelley

## Message

```
stage2: Properly "flatten" elem_ptrs before deref

Sema.pointerDeref() assumes that elem_ptrs have been "flattened" when
they were created, so that you an elem_ptr will never be the array_ptr
of another elem_ptr when they share the same type.

Value.elemPtr does this already, but a couple of places in Sema were
bypassing this logic.

```

## Parents

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

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