title: When an array is created by a subexpression, what happens with the temporaries therein?
body: <p>I was reading these two paragraphs of the FDIS (12.2p{4,5}):</p>
  
  <blockquote>
    <p>There are two contexts in which temporaries are destroyed at a different point than the end of the full-expression. The first context is when a default constructor is called to initialize an element of an array. If the constructor has one or more default arguments, the destruction of every temporary created in a default argument is sequenced before the construction of the next array element, if any.</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>The second context is when a reference is bound to a temporary. The temporary to which the reference is bound or the temporary that is the complete object of a subobject to which the reference is bound persists for the lifetime of the reference except:
    [...]</p>
    
    <ul>
    <li>A temporary bound to a reference parameter in a function call (5.2.2) persists until the completion of the full-expression containing the call.</li>
    </ul>
  </blockquote>
  
  <p>These two two seem to contradict for the following case</p>
  
  <pre><code>struct A {
    A() { std::cout &lt;&lt; "C" &lt;&lt; std::endl; }
    ~A() { std::cout &lt;&lt; "D" &lt;&lt; std::endl; }
  };
  
  struct B {
    B(A const&amp; a = A()) { }
  };
  
  typedef B array[2];
  
  int main() {
    array{};
  }
  </code></pre>
  
  <p>Will this output <code>CDCD</code> as required by the first context, or will this output <code>CCDD</code> as required by the second context? GCC seems to follow the second context description and outputs <code>CCDD</code>. Have I overlooked something important? </p>
  
  <hr>
  
  <p>EDIT: I don't think it needs C++0x. This <code>new</code>-expression is affected too by my question:</p>
  
  <pre><code>new array(); /* CDCD or CCDD ?? */
  </code></pre>
  
  <p>In this case though, GCC follows the first context, and outputs <code>CDCD</code>.</p>