zig/test/cases/compile_errors/fieldParentPtr-non_pointer.zig
Jacob Young 9b2345e182 Sema: rework @fieldParentPtr to accept a pointer type
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.
2024-03-30 20:50:48 -04:00

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'