G++ ABI: bug in non-POD class tail-padding reuse?
Gabriel Dos Reis
gdr@integrable-solutions.net
Wed Nov 13 01:44:00 GMT 2002
Hi,
It has been my understanding that the new ABI reuses tail-padding
for non-POD class-types. However the sizeof() displayed for class B,
defined below, is different from what would have been expected.
More specifically, consider:
#include <iostream>
struct A {
int i;
char c;
};
struct B : A {
char c;
};
int main()
{
std::cout << "sizeof (A) == " << sizeof (A)
<< "\tsizeof (B) == " << sizeof (B) << std::endl;
}
With g++, current CVS (I suspect 3.2.1-pre behaves the same), I get:
sizeof (A) == 8 sizeof (B) == 12
whereas I expect sizeof (B) == 8, since B is a non-POD class-type
and tail-padding should be reused.
What am I missing?
-- Gaby
More information about the Gcc
mailing list