Context
Odin: dev-2026-08-nightly:902106f
OS: Ubuntu Stonking Stingray (development branch), Linux 7.0.0-15-generic
CPU: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
RAM: 31950 MiB
Backend: LLVM 20.1.8
Expected Behavior
The initialized value should contain all fields. Maybe fail to compile with error, but not silent nils.
Current Behavior
The initialized value is incomplete, some procedure pointers are left uninitialized.
Failure Information (for bugs)
Please consider the following code:
package main
import "core:fmt"
Foo :: struct ($N: int) {
data : [N] u8,
number : int,
update : proc (f: ^Foo(N), delta: int),
print : proc (f: Foo(N)),
}
foo_init :: proc (f: ^Foo($N), number: int) {
f^ = {
number = 333,
update = foo_update,
print = foo_print,
}
}
foo_update :: proc (f: ^Foo($N), delta: int) {
f.number += delta
}
foo_print :: proc (f: Foo($N)) {
fmt.println(#procedure, f.number)
}
main :: proc () {
f: Foo(10)
foo_init(&f, 555)
fmt.println(f)
}
The output:
Foo($N=10){data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], number = 333, update = nil, print = nil}
Notice uninitialized pointers update and print -- unexpected. If we change single line number = 333, to number = number, in foo_init() -- so we're actually using provided argument; the output becomes expected:
Foo($N=10){data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], number = 555, update = proc(^Foo($N=10), int) @ 0x625CBF518750, print = proc(Foo($N=10)) @ 0x625CBF518780}
Related issues
Context
Expected Behavior
The initialized value should contain all fields. Maybe fail to compile with error, but not silent
nils.Current Behavior
The initialized value is incomplete, some procedure pointers are left uninitialized.
Failure Information (for bugs)
Please consider the following code:
The output:
Notice uninitialized pointers
updateandprint-- unexpected. If we change single linenumber = 333,tonumber = number,infoo_init()-- so we're actually using provided argument; the output becomes expected:Related issues