aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-01 14:06:51 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-01 14:06:51 -0500
commitae1ebe09b7c1258bfa8de37244fd9b510b1447a4 (patch)
treeaa02aa86d4d916f55b7666f379df78c72fb13cea /test/compile_errors.zig
parentbbe857be96084bae6ca1e5f10e35f3631df50edc (diff)
downloadzig-ae1ebe09b7c1258bfa8de37244fd9b510b1447a4.tar.gz
zig-ae1ebe09b7c1258bfa8de37244fd9b510b1447a4.zip
add compile errror for @bitCast when bit counts mismatch
fixes invalid LLVM IR from previous commit
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index f2a2ba2641..74602b77ff 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,15 @@ const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "@bitCast same size but bit count mismatch",
+ \\export fn entry(byte: u8) void {
+ \\ var oops = @bitCast(u7, byte);
+ \\}
+ ,
+ ".tmp_source.zig:2:16: error: destination type 'u7' has 7 bits but source type 'u8' has 8 bits",
+ );
+
+ cases.add(
"attempted `&&`",
\\export fn entry(a: bool, b: bool) i32 {
\\ if (a && b) {