@@ -292,3 +292,12 @@ test "@sizeOf optional of previously unresolved union" {
|
||||
const Node = union { a: usize };
|
||||
try expect(@sizeOf(?Node) == @sizeOf(Node) + @alignOf(Node));
|
||||
}
|
||||
|
||||
test "@offsetOf zero-bit field" {
|
||||
const S = packed struct {
|
||||
a: u32,
|
||||
b: u0,
|
||||
c: u32,
|
||||
};
|
||||
try expect(@offsetOf(S, "b") == @offsetOf(S, "c"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user