master
1const std = @import("std");
2const expect = std.testing.expect;
3
4const BitField = packed struct {
5 a: u3,
6 b: u3,
7 c: u2,
8};
9
10var bit_field = BitField{
11 .a = 1,
12 .b = 2,
13 .c = 3,
14};
15
16test "pointer to non-byte-aligned field" {
17 try expect(bar(&bit_field.b) == 2);
18}
19
20fn bar(x: *const u3) u3 {
21 return x.*;
22}
23
24// test_error=expected type