This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37715] Different class sizes with public/private and alignments
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Oct 2008 20:46:35 -0000
- Subject: [Bug c++/37715] Different class sizes with public/private and alignments
- References: <bug-37715-1407@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-10-03 20:46 -------
In the private case, A is a non-POD so _c can fit tail part of A. So the
sizeof(M) is 16 bytes.
In the public case, A is a POD so _c is not allowed to be in the tail part of A
(as required by the C++ standard), so the sizeof(M) is 2 * 16. The sizeof (_c)
is 1 as required by the C++ standard.
For the non aligned case, there is no tail part of A for the non POD case as
the alignment and size are equal.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37715