title: Why not always assign return values to const reference?
body: <p>Let's say I have some function:</p>
  
  <pre><code>Foo GetFoo(..)
  {
    ...
  }
  </code></pre>
  
  <p>Assume that we neither know how this function is implemented nor the internals of Foo (it can be very complex object, for example). However we do know that function is returning Foo by value and that we want to use this return value as const.</p>
  
  <p>Question: Would it be always a good idea to store return value of this function as <code>const &amp;</code>?</p>
  
  <pre><code>const Foo&amp; f = GetFoo(...);
  </code></pre>
  
  <p>instead of,</p>
  
  <pre><code>const Foo f = GetFoo(...);
  </code></pre>
  
  <p>I know that compilers would do return value optimizations and may be move the object instead of copying it so in the end <code>const &amp;</code> might not have any advantages. However my question is, are there any <em>disadvantages</em>? Why shouldn't I just develop muscle memory to <em>always</em> use <code>const &amp;</code> to store return values given that I don't have to rely on compiler optimizations and the fact that even move operation can be expensive for complex objects.</p>
  
  <p>Stretching this to extreme, why shouldn't I <em>always</em> use <code>const &amp;</code> for all variables that are immutable in my code? For example,</p>
  
  <pre><code>const int&amp; a = 2;
  const int&amp; b = 2;
  const int&amp; c = c + d;
  </code></pre>
  
  <p>Besides being more verbose, are there any disadvantages?</p>