Parameter passed by const reference returned by const reference
<p>I was reading C++ Faq Second Edition , faq number 32.08 . </p>

<p>FAQ says that parameter passed by const reference and returned by const reference can cause dangling reference.</p>

<p>But it is ok if parameter is passed by reference and returned by reference.</p>

<p>I got it that it is unsafe in case of const reference but how is it safe in case when parameter is non const reference.</p>

<p>Last line of FAQ says
"Note that if a function accepts a parameter by non-const reference (for example, f(string&amp; s)), returning a copy of this reference parameter is safe because a temporary cannot be passed by non-const reference."</p>

<p>Need some insight on this!!</p>
