Sema: add source location to coerce result ptr, fix negation error
This commit is contained in:
committed by
Jakub Konka
parent
979910dc38
commit
cc3336c784
15
test/cases/compile_errors/reassign_to_struct_parameter.zig
Normal file
15
test/cases/compile_errors/reassign_to_struct_parameter.zig
Normal file
@@ -0,0 +1,15 @@
|
||||
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
|
||||
Reference in New Issue
Block a user