aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/struct.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behavior/struct.zig')
-rw-r--r--test/behavior/struct.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig
index 20a09f92cc..a32a0ed495 100644
--- a/test/behavior/struct.zig
+++ b/test/behavior/struct.zig
@@ -1555,3 +1555,21 @@ test "optional generic function label struct field" {
};
try expect((Options{}).isFoo.?(u8) == 123);
}
+
+test "struct fields get automatically reordered" {
+ if (builtin.zig_backend != .stage2_llvm) return error.SkipZigTest; // TODO
+
+ const S1 = struct {
+ a: u32,
+ b: u32,
+ c: bool,
+ d: bool,
+ };
+ const S2 = struct {
+ a: u32,
+ b: bool,
+ c: u32,
+ d: bool,
+ };
+ try expect(@sizeOf(S1) == @sizeOf(S2));
+}