This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Fwd: non-POD error]


Forgot to mention the system:

gcc 3.2.1
Linux 2.4.18
x86

Error does not appear in gcc2.95.3 or 3.1


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]