warning: invalid offsetof from non-POD type

John Quigley johnw@lowestplane.org
Fri Mar 28 17:52:00 GMT 2003


I maintain the GNU/Linux port of a large c++ system.  When compiling it with 
gcc3, I get hundreds of lines of warnings about "invalid offsetof from 
non-POD type, use pointer to method instead".  Despite these many warnings, 
the executable works fine.  

The system uses an "offsetof"-like macro to bind c++ member fields to its 
internal scripting language.  It is not a simple change to replace this 
offsetof scheme with a pointer to member.  

Can someone give me an example of code where the warning would fire and the 
resulting code would give incorrect results? 

- jq

More information about the Gcc-help mailing list