title: C++11 allows in-class initialization of non-static and non-const members. What changed?
body: <p>Before C++11, we could only perform in-class initialization on static const members of integral or enumeration type. <a href="http://www.stroustrup.com/bs_faq2.html#in-class" rel="noreferrer">Stroustrup discusses this in his C++ FAQ</a>, giving the following example:</p>
  
  <pre><code>class Y {
    const int c3 = 7;           // error: not static
    static int c4 = 7;          // error: not const
    static const float c5 = 7;  // error: not integral
  };
  </code></pre>
  
  <p>And the following reasoning:</p>
  
  <blockquote>
    <p>So why do these inconvenient restrictions exist? A class is typically declared in a header file and a header file is typically included into many translation units. However, to avoid complicated linker rules, C++ requires that every object has a unique definition. That rule would be broken if C++ allowed in-class definition of entities that needed to be stored in memory as objects.</p>
  </blockquote>
  
  <p>However, C++11 relaxes these restrictions, allowing in-class initialization of non-static members (§12.6.2/8):</p>
  
  <blockquote>
    <p>In a non-delegating constructor, if a given non-static data member or base class is not designated by a <em>mem-initializer-id</em> (including the case where there is no <em>mem-initializer-list</em> because the constructor has no <em>ctor-initializer</em>) and the entity is not a virtual base class of an abstract class (10.4), then</p>
    
    <ul>
    <li>if the entity is a non-static data member that has a <em>brace-or-equal-initializer</em>, the entity is initialized as specified in 8.5;  </li>
    <li>otherwise, if the entity is a variant member (9.5), no initialization is performed;  </li>
    <li>otherwise, the entity is default-initialized (8.5).</li>
    </ul>
  </blockquote>
  
  <p>Section 9.4.2 also allows in-class initialization of non-const static members if they are marked with the <code>constexpr</code> specifier.</p>
  
  <p>So what happened to the reasons for the restrictions we had in C++03? Do we just simply accept the "complicated linker rules" or has something else changed that makes this easier to implement?</p>