title: Destructor call in a comma-separated expression
body: <p>consider the following example program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  struct t
  {
      ~t() {cout &lt;&lt; "destroyed\n"; }
  };
  int main()
  {
      cout &lt;&lt; "test\n";
      t(), cout &lt;&lt; "doing stuff\n";
      cout &lt;&lt; "end\n";
  }
  </code></pre>
  
  <p>The output I get with GCC 4.9.2 is:</p>
  
  <pre><code>test 
  doing stuff 
  destroyed 
  end
  </code></pre>
  
  <p>cpp.sh link: <a href="http://cpp.sh/3cvm" rel="noreferrer">http://cpp.sh/3cvm</a></p>
  
  <p>However according to cppreference about the comma operator: </p>
  
  <blockquote>
    <p>In a comma expression E1, E2, the expression E1 is evaluated, its result is discarded, and its side effects are completed before evaluation of the expression E2 begins</p>
  </blockquote>
  
  <p>I'd expect <code>~t()</code> to be called before <code>cout &lt;&lt; "doing stuff"</code></p>
  
  <p>Is this a standard behavior? If so, where is it defined in the standard?</p>