# Sema: fix coerce_result_ptr in case of inferred result type · gitcafe/zig

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

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

Visibility: public

Requested revision: 667ad9250f7250670778beedcebc45f5c0284446

Requested commit: 667ad9250f7250670778beedcebc45f5c0284446

Commit: 667ad9250f7250670778beedcebc45f5c0284446

Tree: 76ac3d73766d13be52afa570111e4071d8d19cf9

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: fix coerce_result_ptr in case of inferred result type

Previously, the logic for analyzing coerce_result_ptr would generate
invalid bitcast instructions which did not include coercion logic, such
as optional wrapping, resulting in miscompilations.

Now, the logic of resolve_inferred_alloc goes back over all the
placeholders inserted by coerce_result_ptr, and replaces them with logic
doing the proper coercions.

Closes #12045

```

## Parents

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

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