[Bug c++/51096] No EBCO if a member of the base class type is defined

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 11 14:56:00 GMT 2011


Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-11-11 14:20:12 UTC ---
note that the EBO is performed again if Derived::a is not the first member,
because then it has a distinct address anyway:

struct Derived : public Base {
    bool b;
    Base a;

static_assert(sizeof(Derived) == 2, "empty base");

Closing as invalid, MSVC is wrong to allow two objects of the same type to have
the same address.

More information about the Gcc-bugs mailing list