[Bug c++/70121] [5/6 Regression] spurious warning and crash when returning a reference from lambda

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Mar 18 15:14:00 GMT 2016


Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
The temporary it mentions is a temporary generated within the lambda to hold
the value "28", because we (wrongly) immediately decay the use of 'val' to its
constant value, so the temporary is out of scope after the lambda returns. 
Returning null doesn't seem worse to me, rather it will help people catch
undefined behavior more rapidly.  This is an important bug, certainly, but I
don't think it's a regression.

More information about the Gcc-bugs mailing list