aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/struct.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-01 14:56:43 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-01 14:58:37 -0700
commitf6aaab9406807305c2b48fcd742449c9e91f1851 (patch)
tree2eeae513df72230b216a77c627a612239e7df6e9 /test/behavior/struct.zig
parent1b194931b0df08db0f38a284bb10b89cc00a8817 (diff)
downloadzig-f6aaab9406807305c2b48fcd742449c9e91f1851.tar.gz
zig-f6aaab9406807305c2b48fcd742449c9e91f1851.zip
LLVM: fix tripping assertions
Packed structs were tripping an LLVM assertion due to calling `LLVMConstZExt` from i16 to i16. Solved by using instead `LLVMConstZExtOrBitCast`. Unions were tripping an LLVM assertion due to a typo using the union llvm type to construct an integer value rather than the tag type.
Diffstat (limited to 'test/behavior/struct.zig')
-rw-r--r--test/behavior/struct.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig
index fb4a7c4946..13fe0820ce 100644
--- a/test/behavior/struct.zig
+++ b/test/behavior/struct.zig
@@ -871,10 +871,10 @@ test "non-packed struct with u128 entry in union" {
var sx: S = undefined;
var s = &sx;
- try std.testing.expect(@ptrToInt(&s.f2) - @ptrToInt(&s.f1) == @offsetOf(S, "f2"));
+ try expect(@ptrToInt(&s.f2) - @ptrToInt(&s.f1) == @offsetOf(S, "f2"));
var v2 = U{ .Num = 123 };
s.f2 = v2;
- try std.testing.expect(s.f2.Num == 123);
+ try expect(s.f2.Num == 123);
}
test "packed struct field passed to generic function" {