title: Can initializing expression use the variable itself?
body: <p>Consider the following code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  struct Data
  {
      int x, y;
  };
  
  Data fill(Data&amp; data)
  {
      data.x=3;
      data.y=6;
      return data;
  }
  
  int main()
  {
      Data d=fill(d);
      std::cout &lt;&lt; "x=" &lt;&lt; d.x &lt;&lt; ", y=" &lt;&lt; d.y &lt;&lt; "\n";
  }
  </code></pre>
  
  <p>Here <code>d</code> is copy-initialized from the return value of <code>fill()</code>, but <code>fill()</code> writes to <code>d</code> itself before returning its result. What I'm concerned about is that <code>d</code> is non-trivially used before being initialized, and use of uninitialized variables in some(all?) cases leads to undefined behavior.</p>
  
  <p>So is this code valid, or does it have undefined behavior? If it's valid, will the behavior become undefined once <code>Data</code> stops being POD or in some other case?</p>