title: Testing endianess at compile-time: is this constexpr function correct according to the standard?
body: <p>After some search for a way to check endianess at compile-time I've come up with the following solution: </p>
  
  <pre><code>static const int a{1};
  
  constexpr bool is_big_endian()
  {
      return *((char*)&amp;(a)) == 1;
  }
  </code></pre>
  
  <p>GCC accepts this code only in some contexts where constexpr is required:</p>
  
  <pre><code>int b[is_big_endian() ? 12 : 25]; //works
  std::array&lt;int, testendian() ? 12 : 25&gt; c;  //fails
  </code></pre>
  
  <p>For the second case, GCC says <code>error: accessing value of ‘a’ through a ‘char’ glvalue in a constant expression</code>. I couldn't find anything in the standard that forbids such thing. Maybe someone could clarify in which case GCC is correct?</p>