title: Is it legal to alias a char array through a pointer to int?
body: <p>I know that the following is explicitly allowed in the standard:</p>
  
  <pre><code>int n = 0;
  char *ptr = (char *) &amp;n;
  cout &lt;&lt; *ptr;
  </code></pre>
  
  <p>What about this?</p>
  
  <pre><code>alignas(int) char storage[sizeof(int)];
  int *ptr = (int *) &amp;storage[0];
  *ptr = 0;
  cout &lt;&lt; *ptr;
  </code></pre>
  
  <p>Essentially, I'm asking if the aliasing rules allow for a sequence of chars to be accessed through a pointer to another type. I'd like references to the portions of the standard that indicate one way or another if possible.</p>
  
  <p>Some parts of the standard have left me conflicted; (3.10.10) seems to indicate it would be undefined behavior on the assumption that the dynamic type of <code>storage</code> is not <code>int</code>. However, the definition of dynamic type is unclear to me, and the existence of <code>std::aligned_storage</code> would lead me to believe that this <em>is</em> possible.</p>