We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8796123 commit 2936602Copy full SHA for 2936602
test/behavior/union.zig
@@ -1692,3 +1692,24 @@ test "packed union field pointer has correct alignment" {
1692
try expectEqual(@as(u20, 456), bp.*);
1693
try expectEqual(@as(u20, 789), cp.*);
1694
}
1695
+
1696
+test "union with 128 bit integer" {
1697
+ const ValueTag = enum { int, other };
1698
1699
+ const Value3 = union(ValueTag) {
1700
+ int: i128,
1701
+ other: bool,
1702
+ };
1703
+ var values: [2]Value3 = undefined;
1704
+ values[0] = .{ .int = 3 };
1705
+ values[1] = .{ .int = 4 };
1706
1707
+ var ok: usize = 0;
1708
1709
+ for (values) |val| {
1710
+ switch (val) {
1711
+ .int => ok += 1,
1712
+ else => return error.TestFailed,
1713
+ }
1714
1715
+}
0 commit comments