File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7474 _ = @import ("behavior/bugs/7047.zig" );
7575 _ = @import ("behavior/bugs/7187.zig" );
7676 _ = @import ("behavior/bugs/7325.zig" );
77+ _ = @import ("behavior/bugs/8277.zig" );
7778 _ = @import ("behavior/bugs/8646.zig" );
7879 _ = @import ("behavior/bugs/9584.zig" );
7980 _ = @import ("behavior/bugs/10138.zig" );
Original file line number Diff line number Diff line change 1+ const std = @import ("std" );
2+ const builtin = @import ("builtin" );
3+
4+ test "@sizeOf reified union zero-size payload fields" {
5+ comptime {
6+ try std .testing .expect (0 == @sizeOf (@Type (@typeInfo (union {}))));
7+ try std .testing .expect (0 == @sizeOf (@Type (@typeInfo (union { a : void }))));
8+ if (builtin .mode == .Debug or builtin .mode == .ReleaseSafe ) {
9+ try std .testing .expect (1 == @sizeOf (@Type (@typeInfo (union { a : void , b : void }))));
10+ try std .testing .expect (1 == @sizeOf (@Type (@typeInfo (union { a : void , b : void , c : void }))));
11+ } else {
12+ try std .testing .expect (0 == @sizeOf (@Type (@typeInfo (union { a : void , b : void }))));
13+ try std .testing .expect (0 == @sizeOf (@Type (@typeInfo (union { a : void , b : void , c : void }))));
14+ }
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments