| ... | @@ -1568,3 +1568,16 @@ test "union field pointer capture preserves alignment in inline prong" { | ... | @@ -1568,3 +1568,16 @@ test "union field pointer capture preserves alignment in inline prong" { |
| 1568 | try comptime U.doTheTest(&.{ .a = 123 }); | 1568 | try comptime U.doTheTest(&.{ .a = 123 }); |
| 1569 | try comptime U.doTheTest(&.{ .b = 123 }); | 1569 | try comptime U.doTheTest(&.{ .b = 123 }); |
| 1570 | } | 1570 | } |
| | 1571 | |
| | 1572 | test "switch on expression" { |
| | 1573 | var a: []const []const u8 = &.{ "b", "b", "A", "A", "b" }; |
| | 1574 | _ = &a; |
| | 1575 | var c: isize = 0; |
| | 1576 | for (a[1..]) |b| { |
| | 1577 | switch (b[0] % 2) { |
| | 1578 | 0 => c += 1, |
| | 1579 | else => c -= 1, |
| | 1580 | } |
| | 1581 | } |
| | 1582 | try expect(c == 0); |
| | 1583 | } |