Member subobjects of zero size. Why not?
<p>This is the third question in the series of zero-size objects and subobjects today. 
The standars clearly implies that member subobjects cannot have zero size whereas base class subobjects can. </p>

<pre><code>struct X {}; //empty class, complete objects of class X have nonzero size
struct Y:X { char c; }; //Y's size may be 1 
struct Z {X x; char c;}; //Z's size MUST be greater than 1
</code></pre>

<p>Why not allow zero-size member-subobjects JUST LIKE zero-size base-class-subobjects?</p>

<p>TIA </p>

<p>EDITING after Konrad's answer:
consider the following example:</p>

<pre><code>struct X{}; 
struct D1:X{};
struct D2:D1, X {}; //D2 has 2 distinct subobjects of type X, can they both be 0 size and located at the same address?
</code></pre>

<p>If two base class subobjects of the same type X, as in my example, can be located at the same address, so should be able to member subobjects. If they cannot, then compiler treats this case specially and so can it treat Konrad's example(see answer below) specially and disallow zero-size member subobjects if there are multiple of the same type in the same class. Where am I wrong?</p>
