# stage2: inferred alloc can use bitcast ty · gitcafe/zig

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

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

Visibility: public

Requested revision: cd32b11eb8d33225a1a2bc3bc9e0755936a39ade

Requested commit: cd32b11eb8d33225a1a2bc3bc9e0755936a39ade

Commit: cd32b11eb8d33225a1a2bc3bc9e0755936a39ade

Tree: 9a1d9ccc5011f4cbc8efa9b5d76df597c7b803ca

Author: Mitchell Hashimoto

Committer: Mitchell Hashimoto

## Message

````
stage2: inferred alloc can use bitcast ty

The comment notes that we can't because of constness, but the recent
work by @Vexu lets us use the bitcast ty cause constness comes later.

The following tests pass from this:

```
test "A" {
    const ary = [_:0]u8{42};
    const ptr: [*:0]const u8 = &ary;
    try expect(ptr[1] == 0);
}

test "B" {
    comptime {
        const ary = [_:0]u8{42};
        const ptr: [*:0]const u8 = &ary;
        try expect(ptr[1] == 0);
    }
}
```

````

## Parents

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

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