The offsetof() macro is defined by the C Standard as a portable way to determine the offset, expressed in bytes, from the start of the object to a given member of that object. The C Standard, section subclause 7.17, paragraph 3 [ISO/IEC 9899:1999], specifies, in part:
...
When specifying the type argument for the offsetof() macro, only pass a standard-layout class. The full description of a standard-layout class can be found in section clause 9., paragraph 7, of the C++ Standard, or the type can be checked with the std::is_standard_layout<> type trait. When specifying the member designator argument for the offsetof() macro, do not pass a bit-field, static data member, or function member. Passing an invalid type or member to the offsetof() macro is undefined behavior.
...