diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-08-05 16:52:19 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-08-05 16:54:50 -0400 |
| commit | ad9f48b74bb5d43b767bdf401002d8bfd57c8813 (patch) | |
| tree | af4f30fc3ca17ccdcd2824ce23ec859dcc24e191 /test/compile_errors.zig | |
| parent | 27e4893ee59b965e4c030c43782798db258438ba (diff) | |
| download | zig-ad9f48b74bb5d43b767bdf401002d8bfd57c8813.tar.gz zig-ad9f48b74bb5d43b767bdf401002d8bfd57c8813.zip | |
fix initializing undefined and crash when casting to invalid type
closes #408
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 03e29e3450..e4b42b12a4 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1918,4 +1918,17 @@ pub fn addCases(cases: &tests.CompileErrorContext) { ".tmp_source.zig:1:13: error: aoeu", ".tmp_source.zig:3:19: note: referenced here", ".tmp_source.zig:7:12: note: referenced here"); + + cases.add("instantiating an undefined value for an invalid struct that contains itself", + \\const Foo = struct { + \\ x: Foo, + \\}; + \\ + \\var foo: Foo = undefined; + \\ + \\export fn entry() -> usize { + \\ return @sizeOf(@typeOf(foo.x)); + \\} + , + ".tmp_source.zig:1:13: error: struct 'Foo' contains itself"); } |
