title: Can you violate the strict aliasing rule with std::aligned_union
body: <p>Do the rules for unions, for example <code>[class.mem]</code>p20 also allow to a <code>std::aligned_union_t</code>?  For example if I store two pairs (<code>pair&lt;const A, B&gt;</code> and <code>pair&lt;A, B&gt;</code>) in an <code>std::aligned_union_t</code> with the non const pair active at all times.  Is accessing the <code>pair&lt;const A&gt;</code> type a violation of the strict aliasing rule?</p>
  
  <p>The standard seems to hint in <code>[class.mem]</code>p20 that it is safe to access the const member of the pair even when the non const pair is active</p>
  
  <pre><code>union U {
      std::pair&lt;A, B&gt; pair;
      std::pair&lt;const A, const B&gt; const_pair;
  };
  
  U u = {A{}, B{}};
  cout &lt;&lt; u.const_pair.first &lt;&lt; endl;
  cout &lt;&lt; u.const_pair.second &lt;&lt; endl;
  </code></pre>
  
  <p>But is the same safe for <code>std::aligned_union</code> with placement <code>new</code> and <code>reinterpret_cast</code> to construct and get the right value?</p>
  
  <p>(Assuming that <code>A</code> and <code>B</code> are standard layout)</p>