| 1 | const Foo = struct { |
| 2 | a: i32, |
| 3 | b: i32, |
| 4 | }; |
| 5 | const foo = Foo{ |
| 6 | .a = 1, |
| 7 | .b = 2, |
| 8 | }; |
| 9 | |
| 10 | comptime { |
| 11 | const another_foo_ptr: *const Foo = @fieldParentPtr("b", &foo.a); |
| 12 | _ = another_foo_ptr; |
| 13 | } |
| 14 | |
| 15 | // error |
| 16 | // |
| 17 | // :11:41: error: field 'b' has index '1' but pointer value is index '0' of struct 'tmp.Foo' |
| 18 | // :1:13: note: struct declared here |