diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-10-17 10:06:14 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-10-17 21:08:39 -0400 |
| commit | 2a256d5ea02c8f520c54fd335c38891d6e05a63f (patch) | |
| tree | 1ba784027dc33d9e16b4f59319cb752bfc1f204c /test/compile_errors.zig | |
| parent | e51bc19e4a45211476491f29d2beff73ff6be570 (diff) | |
| download | zig-2a256d5ea02c8f520c54fd335c38891d6e05a63f.tar.gz zig-2a256d5ea02c8f520c54fd335c38891d6e05a63f.zip | |
stage1: Fix type-checking of unary neg for vector types
Validate the vector element type as done for the scalar case.
Fixes #6708
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 062a357a93..496cbda9fb 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -8172,14 +8172,19 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { , &[_][]const u8{ "tmp.zig:2:9: error: @wasmMemoryGrow is a wasm32 feature only", }); - cases.add("Issue #5586: Make unary minus for unsigned types a compile error", - \\export fn f(x: u32) u32 { + \\export fn f1(x: u32) u32 { + \\ const y = -%x; + \\ return -y; + \\} + \\const V = @import("std").meta.Vector; + \\export fn f2(x: V(4, u32)) V(4, u32) { \\ const y = -%x; \\ return -y; \\} , &[_][]const u8{ "tmp.zig:3:12: error: negation of type 'u32'", + "tmp.zig:8:12: error: negation of type 'u32'", }); cases.add("Issue #5618: coercion of ?*c_void to *c_void must fail.", |
