# Byte pointer in packed struct compiler error (0.17.1)

**URL:** <https://ziggit.dev/t/byte-pointer-in-packed-struct-compiler-error-0-17-1/18630>\
**Category:** Help\
**Tags:** language\
**Created:** [November 29, 2026, 10:23am UTC](https://ziggit.dev/t/byte-pointer-in-packed-struct-compiler-error-0-17-1/18630 "2026-11-29T10:23:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericlang](https://ziggit.dev/user_avatar/ziggit.dev/ericlang/32/8515_2.png) [@ericlang](https://ziggit.dev/u/ericlang)\
**Post date:** [November 29, 2026, 10:23am UTC](https://ziggit.dev/t/byte-pointer-in-packed-struct-compiler-error-0-17-1/18630/1 "2026-11-29T10:23:01Z")

</div>

Finally went from Zig 0.15.2 to 0.17.1.

I was wondering about a new compiler error.

having this:

```zig
pub const Bgra = packed struct {
    b: u8,
    g: u8,
    r: u8,
    a: u8,
};

```

error: expected type ‘\*u8’, found ‘\*align(4:16:4) u8’  
when doing tthis:

```zig
var color: Bgra = .empty; // empty not declared here but should be obbious
add(&color.a, somevalue); // What is wrong with the address?

```

```zig
fn add8(dst: *u8, diff: i8) void {
    dst.* +%= @bitCast(diff);
}

```

---

<div class="post-metadata">

**Author:** ![vulpesx](https://ziggit.dev/user_avatar/ziggit.dev/vulpesx/32/3989_2.png) [@vulpesx](https://ziggit.dev/u/vulpesx)\
**Post date:** [November 29, 2026, 10:57am UTC](https://ziggit.dev/t/byte-pointer-in-packed-struct-compiler-error-0-17-1/18630/2 "2026-11-29T10:57:19Z")

</div>

The cases where bit pointers can coerce to normal pointers was made more narrow, probably to avoid bugs in the current implementation.

There is an [accepted proposal](https://github.com/ziglang/zig/issues/24061) to improve them. Though it does not talk about coercion to normal pointers.

---

<div class="post-metadata">

**Author:** ![ericlang](https://ziggit.dev/user_avatar/ziggit.dev/ericlang/32/8515_2.png) [@ericlang](https://ziggit.dev/u/ericlang)\
**Post date:** [November 29, 2026, 11:00am UTC](https://ziggit.dev/t/byte-pointer-in-packed-struct-compiler-error-0-17-1/18630/3 "2026-11-29T11:00:06Z")

</div>

Ah I saw that long proposal yes.  
But: it is not a bit pointer. It is a byte pointer!  
I guess it does only give a compile error in this case (byte inside a packed struct)? Not with a “normal” byte.

---

<div class="post-metadata">

**Author:** ![vulpesx](https://ziggit.dev/user_avatar/ziggit.dev/vulpesx/32/3989_2.png) [@vulpesx](https://ziggit.dev/u/vulpesx)\
**Post date:** [November 29, 2026, 11:04am UTC](https://ziggit.dev/t/byte-pointer-in-packed-struct-compiler-error-0-17-1/18630/4 "2026-11-29T11:04:31Z")

</div>

> [@ericlang](#):
>
> it is not a bit pointer. It is a byte pointer!

nope it’s a bit pointer. The fact that it happens to line up with byte boundaries is irrelevant in the same way an `align(4)` pointer is still align 4 even if it happens to line up with align 8.

---

<div class="post-metadata">

**Author:** ![ericlang](https://ziggit.dev/user_avatar/ziggit.dev/ericlang/32/8515_2.png) [@ericlang](https://ziggit.dev/u/ericlang)\
**Post date:** [November 29, 2026, 11:06am UTC](https://ziggit.dev/t/byte-pointer-in-packed-struct-compiler-error-0-17-1/18630/5 "2026-11-29T11:06:52Z")

</div>

Ok I surrender 🙂 I kinda understand the problem and the proposal.
