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

16 lines
227 B
Zig

const S = struct {
x: u32,
};
fn reassign(s: S) void {
s = S{ .x = 2 };
}
export fn entry() void {
reassign(S{ .x = 3 });
}
// error
// backend=stage2
// target=native
//
// :5:10: error: cannot assign to constant