This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
non-POD error
- From: "Chris Croswhite" <ccroswhite at get2chip dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Thu, 9 Jan 2003 18:03:55 -0800 (PST)
- Subject: non-POD error
- Reply-to: ccroswhite at get2chip dot com
Could someone explain to me why I am seeing this error on the following code:
warning: invalid offsetof from non-POD type `struct
endpoint_net_struct'; use pointer to member instead
Test case:
#include <stdio.h>
#include <linux/stddef.h>
class Myclass {
int _val;
};
struct foo_struct {
void *bar;
Myclass a;
};
int main(void)
{
printf("offset is %d\n", offsetof(struct foo_struct, bar));
}
If I remove the reference to the class, then I do not get this warning. Is
there a correct way to avoid this?
TIA,
Chris