why not crash after the temporary object is destroyed
<pre><code>class C
{
public:
    int True(int i) const
    {
        return i+2;
    }
};


const C&amp; F(const C&amp; c)
{
    return c;
}

int main()
{ 
    const C&amp; c = F(C());                             // Line 1
    cout &lt;&lt; boolalpha &lt;&lt; c.True(1) &lt;&lt; endl;          // Line 2
}
</code></pre>

<p>Question> why the above code can print the value correct?
I assume the variable <code>c</code> will refer to an invalid temporary <code>C</code> object when it hits line 2.</p>

<p>// Update</p>

<p>I would like to update this OP to illustrate the reason why I am concern on this question.</p>

<p>Here is code snippet from C++ Templates: The Complete Guide</p>

<pre><code>// maximum of two values of any type 
template &lt;typename T&gt; 
inline T const&amp; max (T const&amp; a, T const&amp; b) 
{ 
    return a &lt; b ? b : a; 
} 
</code></pre>

<p>As you can see the function return reference to the pass-in parameter.
I just wonder why not the following version instead:</p>

<pre><code>// maximum of two values of any type 
template &lt;typename T&gt; 
inline T max (T const&amp; a, T const&amp; b) 
{ 
    return a &lt; b ? b : a; 
} 
</code></pre>
