diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-01-18 17:47:21 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-01-18 17:47:21 -0500 |
| commit | 4b64c777ee465abb1f4a6bf2d31ba39805d5fa54 (patch) | |
| tree | 2295fd5b511f1fe46b69905fa383c9389044572a /test/compile_errors.zig | |
| parent | 0fc645ab7084c1812d367583b37218359b21c02c (diff) | |
| download | zig-4b64c777ee465abb1f4a6bf2d31ba39805d5fa54.tar.gz zig-4b64c777ee465abb1f4a6bf2d31ba39805d5fa54.zip | |
add compile error for shifting by negative comptime integer
closes #698
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 13373f4737..54ed66e416 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1,13 +1,19 @@ const tests = @import("tests.zig"); pub fn addCases(cases: &tests.CompileErrorContext) { + cases.add("shift by negative comptime integer", + \\comptime { + \\ var a = 1 >> -1; + \\} + , ".tmp_source.zig:2:18: error: shift by negative value -1"); + cases.add("@panic called at compile time", \\export fn entry() { \\ comptime { \\ @panic("aoeu"); \\ } \\} - , "error: encountered @panic at compile-time"); + , ".tmp_source.zig:3:9: error: encountered @panic at compile-time"); cases.add("wrong return type for main", \\pub fn main() -> f32 { } |
