fix implicit casting to *c_void

closes #1588

also some small std lib changes regarding posix sockets
and one doc typo fix
This commit is contained in:
Andrew Kelley
2018-09-26 11:06:09 -04:00
parent 7b204649e3
commit 9485043b3c
7 changed files with 196 additions and 88 deletions

View File

@@ -1,6 +1,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 {