aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/reassign_to_struct_parameter.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-06-28 20:50:14 +0300
committerJakub Konka <kubkon@jakubkonka.com>2022-06-30 09:57:38 +0200
commitcc3336c7841c48622db855be95a79bbd030bade8 (patch)
tree61e33f1add4655dcc28a25c239d5da27477be0e6 /test/cases/compile_errors/reassign_to_struct_parameter.zig
parent979910dc38cd15e506218d5175e5a91f56244055 (diff)
downloadzig-cc3336c7841c48622db855be95a79bbd030bade8.tar.gz
zig-cc3336c7841c48622db855be95a79bbd030bade8.zip
Sema: add source location to coerce result ptr, fix negation error
Diffstat (limited to 'test/cases/compile_errors/reassign_to_struct_parameter.zig')
-rw-r--r--test/cases/compile_errors/reassign_to_struct_parameter.zig15
1 files changed, 15 insertions, 0 deletions
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