# Should the PTR succeed?

**URL:** <https://ziggit.dev/t/should-the-ptr-succeed/18625>\
**Category:** Explain\
**Tags:** language\
**Created:** [November 28, 2026, 5:57pm UTC](https://ziggit.dev/t/should-the-ptr-succeed/18625 "2026-11-28T17:57:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zigo](https://ziggit.dev/user_avatar/ziggit.dev/zigo/32/2414_2.png) [@zigo](https://ziggit.dev/u/zigo)\
**Post date:** [November 28, 2026, 5:57pm UTC](https://ziggit.dev/t/should-the-ptr-succeed/18625/1 "2026-11-28T17:57:43Z")

</div>

```zig
var b = true;

pub fn main() void {
    var x: []const []const u8 = &.{"foo"}; // okay
    _ = &x;

    var y = if (b) x else &.{"foo"}; // error: PTR fails
    _ = &y;
}

```

---

<div class="post-metadata">

**Author:** ![alanza](https://ziggit.dev/user_avatar/ziggit.dev/alanza/32/6006_2.png) [@alanza](https://ziggit.dev/u/alanza)\
**Post date:** [November 28, 2026, 6:30pm UTC](https://ziggit.dev/t/should-the-ptr-succeed/18625/2 "2026-11-28T18:30:52Z")

</div>

i don’t remember what PTR stands for, but I think it’s fine for the type inference to fail here. if you give the if expression a result type (by annotating the type of `y`), the code compiles, so Zig not being smarter about type coercion is A-okay with me in this instance.

---

<div class="post-metadata">

**Author:** ![asibahi](https://ziggit.dev/user_avatar/ziggit.dev/asibahi/32/5416_2.png) [@asibahi](https://ziggit.dev/u/asibahi)\
**Post date:** [November 28, 2026, 7:19pm UTC](https://ziggit.dev/t/should-the-ptr-succeed/18625/3 "2026-11-28T19:19:46Z")

</div>

pear type revolution

---

<div class="post-metadata">

**Author:** ![AndrewKraevskii](https://ziggit.dev/user_avatar/ziggit.dev/andrewkraevskii/32/2564_2.png) [@AndrewKraevskii](https://ziggit.dev/u/AndrewKraevskii)\
**Post date:** [November 28, 2026, 7:30pm UTC](https://ziggit.dev/t/should-the-ptr-succeed/18625/4 "2026-11-28T19:30:13Z")

</div>

latest proposal about peer type resolution: [https://codeberg.org/ziglang/zig/issues/35197](https://codeberg.org/ziglang/zig/issues/35197)
