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]

Re: [Fwd: non-POD error]


"Chris Croswhite" <ccroswhite@get2chip.com> writes:

| 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;
| };

Saying class is equivalent to saying "struct" with making the default
access be private.  Therefore the above declares Myclass as having a
private data member named _val.  Therefore it is not a POD type, since
a POD cannot have a private data member.

[...]

| If I remove the reference to the class, then I do not get this warning.
| Is there a correct way to avoid this?

You probably wanted to say "struct Myclass" and not "class Myclass".

-- Gaby


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