title: UB with typeid invocation
body: <p>I've written the code for the understanding <code>typeid</code> operator.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;typeinfo&gt;
  
  using std::cout;
  using std::endl;
  
  struct C;
  
  struct B
  {
      long unsigned int hash;
  
      B(C *c);
  };
  
  struct C : B
  {
      C() : B(this)
      {
          cout &lt;&lt; "C()" &lt;&lt; endl;
      }
  };
  
  B::B(C *c)
  {
      hash = typeid(*c).hash_code(); //1, UB?
  }
  
  C c;
  int main()
  {
      cout &lt;&lt; c.hash &lt;&lt; endl;
      cout &lt;&lt; typeid(c).hash_code() &lt;&lt; endl;
  }
  </code></pre>
  
  <p>I think the code I've written produce UB at <code>//1</code> because 12.7/5 says</p>
  
  <blockquote>
    <p>If the operand of typeid refers to the object under construction or
    destruction and the static type of the operand is neither the
    constructor or destructor’s class nor one of its bases, the result of
    typeid is undefined</p>
  </blockquote>
  
  <p>Right?</p>