You can certainly store an object of arbitrary type, but here it is done through a pointer to an object with pointer arithmetic going beyond the allowed bounds.
> memcpy takes a void pointer as its destination, sets the effective type of the storage behind it
And, in doing so, may very well overwrite the unspecified padding following 'payload' in the structure, thus instantly destroying the effective type of the structure object itself. Subsequent accesses to the structure or its members will be UB.
It seems to me that your argument hinges on two assumptions:
- there is no padding following 'payload' (this would have to be statically asserted),
- the pointer to 'payload' is indistinguishable from the pointer past the structure; in particular, provenance is not an issue.
That is a very interesting discussion.