aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-04-20 00:55:52 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-04-20 09:05:22 -0700
commitd5f1a8823eb964c6149fc1d627ea6936d70ea7f1 (patch)
tree163967d4c1bac8455b0d3e66734d5788a3f1e6d4 /test/cases/compile_errors
parent31b6d14bf76fa6b78013a6a32d3066e882d64043 (diff)
downloadzig-d5f1a8823eb964c6149fc1d627ea6936d70ea7f1.tar.gz
zig-d5f1a8823eb964c6149fc1d627ea6936d70ea7f1.zip
Sema: allow ptr field access on pointer-to-array
Also remove an incorrect piece of logic which allowed fetching the 'len' property on non-single-ptrs (e.g. many-ptrs) and add a corresponding compile error test case. Resolves: #4765
Diffstat (limited to 'test/cases/compile_errors')
-rw-r--r--test/cases/compile_errors/len_access_on_array_many_ptr.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/cases/compile_errors/len_access_on_array_many_ptr.zig b/test/cases/compile_errors/len_access_on_array_many_ptr.zig
new file mode 100644
index 0000000000..b61b6f94bf
--- /dev/null
+++ b/test/cases/compile_errors/len_access_on_array_many_ptr.zig
@@ -0,0 +1,10 @@
+export fn foo() void {
+ const x: [*][5]u8 = undefined;
+ _ = x.len;
+}
+
+// error
+// backend=stage2
+// target=native
+//
+// :3:10: error: type '[*][5]u8' does not support field access