This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug c++/25927] New: Spurious offsetof warnings with private members
- From: Gabriel Dos Reis <gdr at cs dot tamu dot edu>
- To: gcc-bugzilla at gcc dot gnu dot org
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jan 2006 14:59:43 -0600
- Subject: Re: [Bug c++/25927] New: Spurious offsetof warnings with private members
- References: <bug-25927-6420@http.gcc.gnu.org/bugzilla/>
"rcbilson at plg dot uwaterloo dot ca" <gcc-bugzilla@gcc.gnu.org> writes:
| Consider:
|
| #include <iostream>
| #include <cstddef>
|
| class xxx {
| friend int main();
| void *q;
| public:
| void *r;
| };
|
| int main() {
| std::cout << "offset of xxx::q is " << offsetof( xxx, q ) << "\n";
| std::cout << "offset of xxx::r is " << offsetof( xxx, r ) << "\n";
| return 0;
| }
|
| The class xxx is POD, and the two applications of offsetof should be ok (per
| 18.1p5).
No, the class xxx is not a POD because xxx::q is non-public. Invalid
PR, should be closed.
-- Gaby