# Pass a slice as a default value ptr to a comptime generated struct field

**URL:** <https://ziggit.dev/t/pass-a-slice-as-a-default-value-ptr-to-a-comptime-generated-struct-field/12489>\
**Category:** Help\
**Tags:** language\
**Created:** [October 13, 2025, 5:15pm UTC](https://ziggit.dev/t/pass-a-slice-as-a-default-value-ptr-to-a-comptime-generated-struct-field/12489 "2025-10-13T17:15:49Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![usebeforefree](https://ziggit.dev/user_avatar/ziggit.dev/usebeforefree/32/6726_2.png) [@usebeforefree](https://ziggit.dev/u/usebeforefree)\
**Post date:** [October 13, 2025, 6:00pm UTC](https://ziggit.dev/t/pass-a-slice-as-a-default-value-ptr-to-a-comptime-generated-struct-field/12489/6 "2025-10-13T18:00:04Z")

</div>

No stack traces, no compiler errors, but I did figure it out just now. Yay!

The problem was that I was passing a slice to a var array. When I changed it to const, it works as a charm! I remembered this topic I read today [Comptime-Mutable Memory Changes](https://ziggit.dev/t/comptime-mutable-memory-changes/3702) by mlugg.

I will post the full code when finished, recreate the error. Maybe someone can take a look and see if I was just doing dumb things, if the compiler could have helped me more, or both 🙂

---

_[View the full topic](https://ziggit.dev/t/pass-a-slice-as-a-default-value-ptr-to-a-comptime-generated-struct-field/12489)._
