master
1const 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
11pub export fn entry() void {
12 var s: S = undefined;
13 _ = s.a.str(undefined);
14}
15
16const S2 = struct {
17 a: [*c]anyopaque,
18};
19
20pub export fn entry2() void {
21 var s: S2 = undefined;
22 _ = &s;
23}
24
25// error
26// backend=selfhosted,llvm
27//
28// :6:20: error: cannot @bitCast to '[]i32'
29// :6:20: note: use @ptrCast to cast from '[]u32'
30// :17:12: error: indexable pointer to opaque type 'anyopaque' not allowed