aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-10-03 14:05:55 +0300
committerVeikka Tuominen <git@vexu.eu>2022-10-05 17:26:29 +0300
commit40578656e85a4bd930b03c143f179d43a925d151 (patch)
tree521053cc75e0b05a1baee26f640e1fc6e87c8aa7 /test/behavior
parentc0350cf87eaae64ca81e17aef8872e8e55767437 (diff)
downloadzig-40578656e85a4bd930b03c143f179d43a925d151.tar.gz
zig-40578656e85a4bd930b03c143f179d43a925d151.zip
Zir: handle ranges in `getMultiProng`
Closes #12890
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/bugs/12890.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/behavior/bugs/12890.zig b/test/behavior/bugs/12890.zig
new file mode 100644
index 0000000000..cae79136dc
--- /dev/null
+++ b/test/behavior/bugs/12890.zig
@@ -0,0 +1,18 @@
+const expect = @import("std").testing.expect;
+const builtin = @import("builtin");
+
+fn a(b: []u3, c: u3) void {
+ switch (c) {
+ 0...1 => b[c] = c,
+ 2...3 => b[c] = c,
+ 4...7 => |d| b[d] = c,
+ }
+}
+test {
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
+
+ var arr: [8]u3 = undefined;
+ a(&arr, 5);
+ try expect(arr[5] == 5);
+}