title: What does the error about default member initializer needed means?
body: <p>I have a code that works fine in Visual Studio:</p>
  <pre><code>struct A
  {
      struct P{ P() = default; int x = 1; };
      void foo( const P &amp; = {} );
  };
  
  </code></pre>
  <p>However both <code>gcc</code> and <code>clang</code> refuse to compile it with the error:</p>
  <pre><code>&lt;source&gt;:4:28: error: default member initializer for 'A::P::x' required before the end of its enclosing class
      4 |     void foo( const P &amp; = {} );
  </code></pre>
  <p><a href="https://gcc.godbolt.org/z/ja3c9zPMY" rel="nofollow noreferrer">https://gcc.godbolt.org/z/ja3c9zPMY</a></p>
  <p>Could you please suggest what is wrong with the code?</p>