master
1export fn entry1() void {
2 _ = @sizeOf(packed struct(u32) {
3 x: u1,
4 y: u24,
5 z: u4,
6 });
7}
8export fn entry2() void {
9 _ = @sizeOf(packed struct(i31) {
10 x: u4,
11 y: u24,
12 z: u4,
13 });
14}
15
16export fn entry3() void {
17 _ = @sizeOf(packed struct(void) {
18 x: void,
19 });
20}
21
22export fn entry4() void {
23 _ = @sizeOf(packed struct(void) {});
24}
25
26export fn entry5() void {
27 _ = @sizeOf(packed struct(noreturn) {});
28}
29
30export fn entry6() void {
31 _ = @sizeOf(packed struct(f64) {
32 x: u32,
33 y: f32,
34 });
35}
36
37export fn entry7() void {
38 _ = @sizeOf(packed struct(*u32) {
39 x: u4,
40 y: u24,
41 z: u4,
42 });
43}
44
45// error
46//
47// :2:31: error: backing integer type 'u32' has bit size 32 but the struct fields have a total bit size of 29
48// :9:31: error: backing integer type 'i31' has bit size 31 but the struct fields have a total bit size of 32
49// :17:31: error: expected backing integer type, found 'void'
50// :23:31: error: expected backing integer type, found 'void'
51// :27:31: error: expected backing integer type, found 'noreturn'
52// :31:31: error: expected backing integer type, found 'f64'
53// :38:31: error: expected backing integer type, found '*u32'