minimal example
package test
import "core:fmt"
main :: proc() {
@(rodata, static)
data := [][]f64{{1, 2, 3, 4}, {5, 6, 7, 8, 9, 10}}
fmt.println(data[0][0]) // 1
data[0][0] = 42 // will compile, but NOT crash at runtime
fmt.println(data[0][0]) // 42
}
Issue: when declaring an @(rodata, static) slice literal the fixed array backing is still considered mutable by the compiler but does NOT crash at runtime
Desired
Compiler should error (if possible) when trying to mutate a slice literal but should at least crash at runtime if compiler passes it
compiler command
odin run . or odin build .
system info
Odin 2025-01
Windows
LLVM 18.1.8
suggested labels
?
minimal example
Issue: when declaring an @(rodata, static) slice literal the fixed array backing is still considered mutable by the compiler but does NOT crash at runtime
Desired
Compiler should error (if possible) when trying to mutate a slice literal but should at least crash at runtime if compiler passes it
compiler command
odin run . or odin build .
system info
Odin 2025-01
Windows
LLVM 18.1.8
suggested labels
?