aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-22 13:28:57 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-22 13:28:57 -0500
commit52bb71867d8d6e738eefb7dafead875eb21a4ae7 (patch)
tree317c8b0f23e603c590f943700587c3a6596bc8ff /test/compile_errors.zig
parent2fe8a0831f2830a3357cdf65b2ebfe1214b13a83 (diff)
downloadzig-52bb71867d8d6e738eefb7dafead875eb21a4ae7.tar.gz
zig-52bb71867d8d6e738eefb7dafead875eb21a4ae7.zip
implement vector negation
also fix vector behavior tests, they weren't actually testing runtime vectors, but now they are. See #903
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index c39d34b3e9..48eb7cd85d 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,18 @@ const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.addTest(
+ "comptime vector overflow shows the index",
+ \\comptime {
+ \\ var a: @Vector(4, u8) = []u8{ 1, 2, 255, 4 };
+ \\ var b: @Vector(4, u8) = []u8{ 5, 6, 1, 8 };
+ \\ var x = a + b;
+ \\}
+ ,
+ ".tmp_source.zig:4:15: error: operation caused overflow",
+ ".tmp_source.zig:4:15: note: when computing vector element at index 2",
+ );
+
+ cases.addTest(
"packed struct with fields of not allowed types",
\\const A = packed struct {
\\ x: anyerror,