This is the mail archive of the gcc-bugs@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: [Bug c++/25927] New: Spurious offsetof warnings with private members


"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


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