aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-09-18 16:32:40 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-09-18 16:32:40 -0400
commitc1af3605328d21f59ee8ceba3c7350193f0a2429 (patch)
treea0a7ae69ff7a6772e8f341aad291278833d389ad /test/compile_errors.zig
parent148fe2e99970ca880a8e10ded5af308e28bbc342 (diff)
downloadzig-c1af3605328d21f59ee8ceba3c7350193f0a2429.tar.gz
zig-c1af3605328d21f59ee8ceba3c7350193f0a2429.zip
add compile error for slice.*.len
closes #1372
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index a1dd33fb43..0b1446b518 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,16 @@ const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "deref slice and get len field",
+ \\export fn entry() void {
+ \\ var a: []u8 = undefined;
+ \\ _ = a.*.len;
+ \\}
+ ,
+ ".tmp_source.zig:3:12: error: attempt to dereference non-pointer type '[]u8'",
+ );
+
+ cases.add(
"@ptrCast a 0 bit type to a non- 0 bit type",
\\export fn entry() bool {
\\ var x: u0 = 0;