aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/reassign_to_struct_parameter.zig
blob: f2b4dc04449bf2c24bea6e94d60f14a162add7a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const S = struct {
    x: u32,
};
fn reassign(s: S) void {
    s = S{ .x = 2 };
}
export fn entry() void {
    reassign(S{ .x = 3 });
}

// error
//
// :5:5: error: cannot assign to constant