That change to offset_of was made in the belief that the old definition was a workaround for old versions of gcc. But that isn't correct.
offsetof with a non-POD type is undefined behavior in C++98. C++11 relaxed the restriction to allow standard-layout types. C++17 changed offsetof with a non-standard-layout type to be "conditionally supported", which is more or less effectively UB for portable code.
Contrary to what was said in the RFR for
The part of
- relates to
-
JDK-8300080 offset_of for GCC/Clang exhibits undefined behavior and is not always a compile-time constant
- Open
-
JDK-8238281 Raise minimum gcc version needed to 5.0
- Resolved