| 1 | const S = struct { |
| 2 | b: u32, |
| 3 | c: i32, |
| 4 | a: struct { |
| 5 | pub fn str(_: @This(), extra: []u32) []i32 { |
| 6 | return @bitCast(extra); |
| 7 | } |
| 8 | }, |
| 9 | }; |
| 10 | |
| 11 | pub export fn entry() void { |
| 12 | var s: S = undefined; |
| 13 | _ = s.a.str(undefined); |
| 14 | } |
| 15 | |
| 16 | const S2 = struct { |
| 17 | a: [*c]anyopaque, |
| 18 | }; |
| 19 | |
| 20 | pub export fn entry2() void { |
| 21 | var s: S2 = undefined; |
| 22 | _ = &s; |
| 23 | } |
| 24 | |
| 25 | // error |
| 26 | // |
| 27 | // :6:20: error: cannot @bitCast to '[]i32' |
| 28 | // :6:20: note: use @ptrCast to cast from '[]u32' |
| 29 | // :17:12: error: indexable pointer to opaque type 'anyopaque' not allowed |