Why const char* static field has to be constexpr to initialize it inside class?
<p>I have the following piece of code:</p>



<pre><code>struct st
{
  static constexpr const int x = 2;
  static constexpr int x2 = 2;
  static const int x3 = 2;
  static const char* str = "BLAH"; // ERROR
};
</code></pre>

<p>marked line gives me the following error:</p>

<blockquote>
  <p>error: ‘constexpr’ needed for in-class initialization of static data
  member ‘const char* st::str’ of non-integral type [-fpermissive]</p>
</blockquote>

<p>When I add <code>constexpr</code> to it, it's all dandy. </p>



<pre><code>struct st
{
  // ...
  static constexpr const char* str = "BLAH"; // OK
};
</code></pre>

<p>Why is it like this? Since initialization of non plain types (e.g. <code>std::string</code> or user defined types) are not allowed in class body why <code>const char*</code> is but only with <code>constexpr</code>?</p>