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