C++ optimise away private variable
<p>Does ISO C++ (11) permit a private non-static class member variable to be optimised away?
This could be detected:</p>

<pre><code>class X { int x; };
assert (sizeof(X) &gt;= sizeof(int));
</code></pre>

<p>but I am not aware of a clause that demands the assertion above. </p>

<p>To clarify: (a) Is there a clause in the C++ Standard that ensure the assertion above.</p>

<p>(b) Can anyone think of any other way to detect the elision of x?
[offsetof?]</p>

<p>(c) Is the optimisation permitted anyhow, despite (a) and (b)?</p>

<p>I have a feeling the optimisation could be possible if the class is local to a function but not otherwise (but I'd like to have a definitive citation).</p>
