Files
zig/test/cases/compile_errors/assign_to_constant_field.zig
2023-06-19 12:34:42 -07:00

16 lines
222 B
Zig

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