diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-02-16 15:22:29 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-02-16 15:22:29 -0500 |
| commit | 72ca2b214d4ffbaeed4840a806fb63740cf13c05 (patch) | |
| tree | 798850ee35ed9e6943aa1eb01a283137d16b6702 /test/compile_errors.zig | |
| parent | cbbd6cfa1e85dc5cda38572f7a1d462a678c2adf (diff) | |
| download | zig-72ca2b214d4ffbaeed4840a806fb63740cf13c05.tar.gz zig-72ca2b214d4ffbaeed4840a806fb63740cf13c05.zip | |
ability to slice an undefined pointer at compile time if the len is 0
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 90b3ff023a..940125711b 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1,6 +1,13 @@ const tests = @import("tests.zig"); pub fn addCases(cases: &tests.CompileErrorContext) void { + cases.add("comptime slice of undefined pointer non-zero len", + \\export fn entry() void { + \\ const slice = (&i32)(undefined)[0..1]; + \\} + , + ".tmp_source.zig:2:36: error: non-zero length slice of undefined pointer"); + cases.add("type checking function pointers", \\fn a(b: fn (&const u8) void) void { \\ b('a'); |
