File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 74
74
_ = @import ("behavior/bugs/7047.zig" );
75
75
_ = @import ("behavior/bugs/7187.zig" );
76
76
_ = @import ("behavior/bugs/7325.zig" );
77
+ _ = @import ("behavior/bugs/8277.zig" );
77
78
_ = @import ("behavior/bugs/8646.zig" );
78
79
_ = @import ("behavior/bugs/9584.zig" );
79
80
_ = @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