This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [Fwd: non-POD error]
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: ccroswhite at get2chip dot com
- Cc: <gcc at gcc dot gnu dot org>
- Date: 10 Jan 2003 11:06:50 +0100
- Subject: Re: [Fwd: non-POD error]
- Organization: Integrable Solutions
- References: <34358.64.169.83.2.1042164928.squirrel@webmail01.get2chip.com>
"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