title: Could we access member of a non-existing class type object?
body: <p>In the c++ standard, in <a href="http://eel.is/c++draft/basic.lval#11.6" rel="noreferrer">[basic.lval]/11.6</a> says:</p>
  <blockquote>
  <p>If a program attempts to access the stored value of an object through a glvalue of other than one of the following types the behavior is undefined:[...]</p>
  <ul>
  <li>an aggregate or union type that includes one of the aforementioned types among its elements or non-static data members (including, recursively, an element or non-static data member of a subaggregate or contained union),[...]</li>
  </ul>
  </blockquote>
  <p>This sentence is part of the <em>strict-aliasing</em> rule.</p>
  <p>Does it allow us to alias through class member access?</p>
  <pre><code>class A{ //&quot;casted to&quot; aggregate
    int i;
    float g;
    };
  
  int j=10;
  int l = reinterpret_cast&lt;A*&gt;(&amp;j)-&gt;i;
  </code></pre>
  <p>According to the standard, an object value is only accessed if the object is subject to <em>lvalue-to-rvalue-conversion</em> <a href="http://eel.is/c++draft/conv.lval#2.sentence-1" rel="noreferrer">[conv.lval]/2</a>.</p>
  <p><a href="http://eel.is/c++draft/expr.ref" rel="noreferrer">[expr.ref]</a> does not stipulate that the <em>object-expression</em> must refer to an object of that type, only that the glvalue must have class type (the <em>object-expression</em> is the expression at the left of the dot &quot;.&quot;). Nevertheless there is a word that recurrently appears in sentence related to member access which may imply constraint on the program that I overlooked. For example <a href="http://eel.is/c++draft/expr.ref#4.1.sentence-1" rel="noreferrer">[expr.ref]/4.1</a>:</p>
  <blockquote>
  <p>If E2 is a static data member and the type of E2 is T, then E1.E2 is an lvalue; the expression <em>designates</em> the named member of the class.</p>
  </blockquote>
  <p>Could &quot;designates&quot; means that this member is within its lifetime and that I cannot use class member access to perfom aliasing? Or is it allowed by [basic.lval]/11.6?</p>