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