aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-09-26 11:06:09 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-09-26 11:06:09 -0400
commit9485043b3c445a3153e61c0bbc908486134d564a (patch)
tree9a8d9f36bd6b445e49e166aaf716d9559d4538c8 /test/compile_errors.zig
parent7b204649e3af348a7831837d5a36219733b505ca (diff)
downloadzig-9485043b3c445a3153e61c0bbc908486134d564a.tar.gz
zig-9485043b3c445a3153e61c0bbc908486134d564a.zip
fix implicit casting to *c_void
closes #1588 also some small std lib changes regarding posix sockets and one doc typo fix
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index d5d0cb38f2..19bb630fb7 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,18 @@ const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "don't implicit cast double pointer to *c_void",
+ \\export fn entry() void {
+ \\ var a: u32 = 1;
+ \\ var ptr: *c_void = &a;
+ \\ var b: *u32 = @ptrCast(*u32, ptr);
+ \\ var ptr2: *c_void = &b;
+ \\}
+ ,
+ ".tmp_source.zig:5:26: error: expected type '*c_void', found '**u32'",
+ );
+
+ cases.add(
"runtime index into comptime type slice",
\\const Struct = struct {
\\ a: u32,