"Use of the offsetof macro with a type other than a standard-layout
class (11.2) is conditionally-supported. ... The result of applying the
offsetof macro to a static data member or a function member is
undefined." (17.2.4p1)
As a general rule, if there is in fact a constant offset from the
beginning of a given class instance to a given member of that object,
the behavior of offsetof() will be well-defined, and the implementation
will support the use of offsetof() for obtaining that offset. To put it
the other way around, if use of offsetof() has undefined behavior or is
not supported, then the distance between those two things might not be
constant. Therefore, if you can't use offsetof(), it's unlikely that
there will be any workaround.