mirror of
https://github.com/ziglang/zig.git
synced 2026-01-24 16:25:25 +00:00
There is no way to know the expected parent pointer attributes (most notably alignment) from the type of the field pointer, so provide them in the first argument.
11 lines
188 B
Zig
11 lines
188 B
Zig
const Foo = i32;
|
|
export fn foo(a: *i32) *Foo {
|
|
return @fieldParentPtr(Foo, "a", a);
|
|
}
|
|
|
|
// error
|
|
// backend=llvm
|
|
// target=native
|
|
//
|
|
// :3:28: error: expected pointer type, found 'i32'
|