2022-08-03 17:55:27 +01:00
|
|
|
const S = struct {
|
|
|
|
b: u32,
|
|
|
|
c: i32,
|
|
|
|
a: struct {
|
|
|
|
pub fn str(_: @This(), extra: []u32) []i32 {
|
2023-06-22 18:46:56 +01:00
|
|
|
return @bitCast(extra);
|
2022-08-03 17:55:27 +01:00
|
|
|
}
|
2023-06-15 08:14:16 +01:00
|
|
|
},
|
2022-08-03 17:55:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
//
|
|
|
|
// :17:12: error: C pointers cannot point to opaque types
|
2023-06-22 18:46:56 +01:00
|
|
|
// :6:20: error: cannot @bitCast to '[]i32'
|
|
|
|
// :6:20: note: use @ptrCast to cast from '[]u32'
|