1const EnumInferred = enum {};
2const EnumExplicit = enum(noreturn) {};
3const EnumNonexhaustive = enum(u8) { _ };
4
5const U0 = union {};
6const U1 = union(enum) {};
7const U2 = union(enum(noreturn)) {};
8const U3 = union(EnumInferred) {};
9const U4 = union(EnumExplicit) {};
10const U5 = union(EnumNonexhaustive) {};
11
12export fn size0() void {
13 _ = @sizeOf(U0);
14}
15export fn size1() void {
16 _ = @sizeOf(U1);
17}
18export fn size2() void {
19 _ = @sizeOf(U2);
20}
21export fn size3() void {
22 _ = @sizeOf(U3);
23}
24export fn size4() void {
25 _ = @sizeOf(U4);
26}
27export fn size5() void {
28 _ = @sizeOf(U5);
29}
30
31export fn align0() void {
32 _ = @alignOf(U0);
33}
34export fn align1() void {
35 _ = @alignOf(U1);
36}
37export fn align2() void {
38 _ = @alignOf(U2);
39}
40export fn align3() void {
41 _ = @alignOf(U3);
42}
43export fn align4() void {
44 _ = @alignOf(U4);
45}
46export fn align5() void {
47 _ = @alignOf(U5);
48}
49
50// error
51//
52// :13:17: error: no size available for uninstantiable type 'tmp.U0'
53// :5:12: note: union declared here
54// :16:17: error: no size available for uninstantiable type 'tmp.U1'
55// :6:12: note: union declared here
56// :19:17: error: no size available for uninstantiable type 'tmp.U2'
57// :7:12: note: union declared here
58// :22:17: error: no size available for uninstantiable type 'tmp.U3'
59// :8:12: note: union declared here
60// :25:17: error: no size available for uninstantiable type 'tmp.U4'
61// :9:12: note: union declared here
62// :28:17: error: no size available for uninstantiable type 'tmp.U5'
63// :10:12: note: union declared here
64// :32:18: error: no align available for uninstantiable type 'tmp.U0'
65// :5:12: note: union declared here
66// :35:18: error: no align available for uninstantiable type 'tmp.U1'
67// :6:12: note: union declared here
68// :38:18: error: no align available for uninstantiable type 'tmp.U2'
69// :7:12: note: union declared here
70// :41:18: error: no align available for uninstantiable type 'tmp.U3'
71// :8:12: note: union declared here
72// :44:18: error: no align available for uninstantiable type 'tmp.U4'
73// :9:12: note: union declared here
74// :47:18: error: no align available for uninstantiable type 'tmp.U5'
75// :10:12: note: union declared here