| ... | @@ -292,3 +292,12 @@ test "@sizeOf optional of previously unresolved union" { | ... | @@ -292,3 +292,12 @@ test "@sizeOf optional of previously unresolved union" { |
| 292 | const Node = union { a: usize }; | 292 | const Node = union { a: usize }; |
| 293 | try expect(@sizeOf(?Node) == @sizeOf(Node) + @alignOf(Node)); | 293 | try expect(@sizeOf(?Node) == @sizeOf(Node) + @alignOf(Node)); |
| 294 | } | 294 | } |
| | 295 | |
| | 296 | test "@offsetOf zero-bit field" { |
| | 297 | const S = packed struct { |
| | 298 | a: u32, |
| | 299 | b: u0, |
| | 300 | c: u32, |
| | 301 | }; |
| | 302 | try expect(@offsetOf(S, "b") == @offsetOf(S, "c")); |
| | 303 | } |