| 1 | const E = enum { |
| 2 | a, |
| 3 | b, |
| 4 | }; |
| 5 | const U = union(E) { |
| 6 | a: u32, |
| 7 | b: u64, |
| 8 | }; |
| 9 | fn foo() E { |
| 10 | return E.b; |
| 11 | } |
| 12 | export fn doTheTest() u64 { |
| 13 | var u: U = foo(); |
| 14 | return (&u).b; |
| 15 | } |
| 16 | |
| 17 | // error |
| 18 | // |
| 19 | // :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields |
| 20 | // :6:5: note: field 'a' has type 'u32' |
| 21 | // :7:5: note: field 'b' has type 'u64' |
| 22 | // :5:11: note: union declared here |