title: C++: Is value initialisation apply recursively?
body: <p>I have the below codes:</p>
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  using namespace std;
  
  class X { 
  public:
      //X() {}
      int getX() const { return this -&gt; x; }
  private:
      int x; // &lt;-- Tag 3
  };
  
  class Y { 
  public:
      //Y() {}
      int getX() const { return this -&gt; x.getX(); }
  private:
      X x; // &lt;-- Tag 2 value or default initialisation?
  };
  
  int main() {
      X x{};
      cout &lt;&lt; x.getX() &lt;&lt; endl;
  
      Y y{}; // &lt;-- Tag 1 - value initialisation
      cout &lt;&lt; y.getX() &lt;&lt; endl;
  }
  </code></pre>
  <p>Results:</p>
  <pre class="lang-none prettyprint-override"><code>0
  0
  </code></pre>
  <p>Question:</p>
  <ol>
  <li>Is Tag 2 value or default initialisation?</li>
  <li>If Tag 2 is value initialised then Tag 3 be 0 since Class X will use the synthesized ctor. This seems to be the case since it produce 0.</li>
  </ol>
  <p>Also on another note, the compilation shows data members are all initialised.</p>
  <pre class="lang-none prettyprint-override"><code>$ g++ -std=c++11 -Wuninitialized -O2 -pedantic-errors -o a.o a.cc
  $ 
  </code></pre>
  <p>Any help would be great!</p>