[Bug c++/60336] empty struct value is passed differently in C and C++

vagran.ast at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 13 05:05:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336

--- Comment #24 from vagran <vagran.ast at gmail dot com> ---
Just to be on a safe side, please, also do not forget that empty struct (or
class) is really zero in the case when another structure (or class) is derived
from it. For example, such test would be useful after fix:

struct A {};

struct B: A {
    int i;
};

assert(sizeof(B) == sizeof(int));

And something like this:

struct A {};
struct B: A {};
struct C: B {};
struct D: C {};

assert(sizeof(D) == 1);



More information about the Gcc-bugs mailing list