invalid offsetof from non-POD type

Joe Buck jbuck@synopsys.com
Tue Apr 22 18:24:00 GMT 2003


On Tue, Apr 22, 2003 at 12:03:04PM +0200, Gabriel Dos Reis wrote:
> Nathan Sidwell <nathan@codesourcery.com> writes:
> 
> [...]
> 
> | Like Zack, I think it strange that I can write &thing.member but not
> | offsetof(thing, member) (modulo virtual bases). I can even write
> | '(char *)&thing.member - (char *)&thing', and all sane compilers will
> | evaluate it at compile time.
> 
> I don't know whether you take GCC to be a "sane" compiler, but it
> can't evaluate this at compile-time -- and if it does, then I would say
> it is broken.

[ example deleted ]

Your example uses references, so Nathan needs at least one more "modulo".




More information about the Gcc-bugs mailing list