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]

non-POD error


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]