cpp/language/ebo

Allows the size of an empty base subobject to be zero.

Explanation
The size of any or member subobject is required to be at least 1 even if the type is an empty  (that is, a class or struct that has no non-static data members),  in order to be able to guarantee that the addresses of distinct objects of the same type are always distinct.

However, base class subobjects are not so constrained, and can be completely optimized out from the object layout:

Empty base optimization is prohibited if one of the empty base classes is also the type or the base of the type of the first non-static data member, since the two base subobjects of the same type are required to have different addresses within the object representation of the most derived type.

A typical example of such situation is the naive implementation of std (derived from the empty base std), which holds the underlying iterator (also derived from std) as its first non-static data member.

If multiple inheritance occurs, then the specific optimizations are compiler specific. In MSVC, the null base class optimization is applied with and only with the last null base class, the rest of the null base classes are not applied with the null base optimization and one byte is allocated. In GCC, no matter how many empty base classes exist, the empty base class applies the empty base class optimization without allocating any space and the empty base class address is the same as the first address of the derived class object.