mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 16:24:51 +00:00
parent
c40448eb9a
commit
6d6195424d
@ -2,6 +2,25 @@ const tests = @import("tests.zig");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
cases.add(
|
||||
"invalid multiple dereferences",
|
||||
\\export fn a() void {
|
||||
\\ var box = Box{ .field = 0 };
|
||||
\\ box.*.field = 1;
|
||||
\\}
|
||||
\\export fn b() void {
|
||||
\\ var box = Box{ .field = 0 };
|
||||
\\ var boxPtr = &box;
|
||||
\\ boxPtr.*.*.field = 1;
|
||||
\\}
|
||||
\\pub const Box = struct {
|
||||
\\ field: i32,
|
||||
\\};
|
||||
,
|
||||
"tmp.zig:3:8: error: attempt to dereference non-pointer type 'Box'",
|
||||
"tmp.zig:8:13: error: attempt to dereference non-pointer type 'Box'",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
"usingnamespace with wrong type",
|
||||
\\use void;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user