Right, but what I'm wondering is whether addressable fields need to be properly aligned. If not (i.e. if we still want the ability to pack structs as an optimisation, without explicit opt-in), then it might not be safe to construct a typed pointer to a field.
We could perhaps just say that we'll return nil
if the compiler decides to pack the field in a way that leaves it non-aligned. @John_McCall said in another thread that this is also possible if the compiler decides to make a field non-addressable:
I'm a little uneasy about that (for both cases, struct-packing and bit-packing). It means that the optimiser can change the observable semantics of a program, and that both the proposed pointer-to-field and existing address-of-field APIs are inherently unreliable. The optimiser is built on heuristics which can change at any time.