title: Ambiguity about the C ++ standard
body: <p>According to this code :</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  struct T {
      T() { cout &lt;&lt; &quot;default&quot;&lt;&lt;endl; }
      T(string s) { cout &lt;&lt; &quot;ctor &quot;&lt;&lt; endl; }
      T(const T&amp; t) { cout &lt;&lt; &quot;copy ctor&quot;&lt;&lt; endl; }
  };
  int main()
  {
      T x = T(T(T()));
      return 0;
  }
  </code></pre>
  <p>output :</p>
  <pre><code>default
  </code></pre>
  <p>and according to <a href="http://eel.is/c++draft/dcl.init#17" rel="nofollow noreferrer">standard</a>:</p>
  <blockquote>
  <p>(17) The semantics of initializers are as follows. The destination
  type is the type of the object or reference being initialized and the
  source type is the type of the initializer expression. If the
  initializer is not a single (possibly parenthesized) expression, the
  source type is not defined.</p>
  <p>.....</p>
  <p>(17.6.1) If the initializer expression is a prvalue and the
  cv-unqualified version of the source type is the same class as the
  class of the destination, the initializer expression is used to
  initialize the destination object. [Example: T x = T(T(T())); calls
  the T default constructor to initialize x. — end example]</p>
  </blockquote>
  <p>it gives the same result in c ++ 11 (GNU GCC v7.1.1)</p>
  <p>First question:
  Is the source type defined in this statement?</p>
  <pre><code>T x = T(T(T()));
  </code></pre>
  <p>Now if we add this function to this code :</p>
  <pre><code>string f(T t) {return &quot;str&quot;;}
  </code></pre>
  <p>and replacement <code>T x = T(T(f(T())));</code> for <code>T x = T(T(T()));</code></p>
  <p>output :</p>
  <pre><code>default
  ctor
  </code></pre>
  <p>now is the source type defined?</p>
  <p>isn't <code>T()</code> initializer expression?</p>
  <p>if yes According to the standard, the default constructor should be called, but why is the <code>T(string s)</code> called for x?</p>