[Bug c++/51270] missed warning about returning reference to temporary

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 22 19:23:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51270

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-11-22 18:56:37 UTC ---
I don't think the warning should be restricted to conversions that only involve
different const-ness.

Here's a simpler testcase for the missed warning:

const int& f(long l)
{
  const int& i = l;
  return i;
}

See also PR 51066



More information about the Gcc-bugs mailing list