master
1const E = enum(u8) {
2 a,
3 b,
4 _,
5};
6const U = union(E) {
7 a,
8 b,
9};
10export fn foo() void {
11 var e: E = @enumFromInt(15);
12 var u: U = e;
13 _ = .{ &e, &u };
14}
15export fn bar() void {
16 const e: E = @enumFromInt(15);
17 var u: U = e;
18 _ = &u;
19}
20
21// error
22//
23// :12:16: error: runtime coercion to union 'tmp.U' from non-exhaustive enum
24// :1:11: note: enum declared here
25// :17:16: error: union 'tmp.U' has no tag with value '@enumFromInt(15)'
26// :6:11: note: union declared here