title: Const reference to temporary
body: <p>After reading <a href="http://herbsutter.wordpress.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/" rel="noreferrer">this article</a> on Herb Sutter's blog, I experimented a bit and ran into something that puzzles me. I am using Visual C++ 2005, but I would be surprised if this was implementation dependent.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  struct Base {
      //Base() {}
      ~Base() { cout &lt;&lt; "~Base()" &lt;&lt; endl; }
  };
  
  int main()
  {
      const Base &amp; f = Base();
  }
  </code></pre>
  
  <p>When run, it displays "<code>~Base()</code>" <strong>twice</strong>... But if I un-comment the constructor, it displays it only <strong>once</strong>!</p>
  
  <p>Does anyone have an explanation for this?</p>