From cc3336c7841c48622db855be95a79bbd030bade8 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Tue, 28 Jun 2022 20:50:14 +0300 Subject: Sema: add source location to coerce result ptr, fix negation error --- .../cases/compile_errors/reassign_to_struct_parameter.zig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/cases/compile_errors/reassign_to_struct_parameter.zig (limited to 'test/cases/compile_errors/reassign_to_struct_parameter.zig') diff --git a/test/cases/compile_errors/reassign_to_struct_parameter.zig b/test/cases/compile_errors/reassign_to_struct_parameter.zig new file mode 100644 index 0000000000..963448f8fe --- /dev/null +++ b/test/cases/compile_errors/reassign_to_struct_parameter.zig @@ -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 -- cgit v1.2.3