Files
zig/test/cases/compile_errors/assign_to_constant_field.zig
2022-10-20 20:11:00 +03:00

14 lines
209 B
Zig

const Foo = struct {
field: i32,
};
export fn derp() void {
const f = Foo {.field = 1234,};
f.field = 0;
}
// error
// backend=stage2
// target=native
//
// :6:6: error: cannot assign to constant