[Bug c++/61597] Unexpected behavior at runtime

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 25 10:12:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61597

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #11)
> decltype(iter += i) is Iter& so you return a reference to a temporary which
> goes out of scope

Sorry, temporary is the wrong word - a reference to a local variable, which
goes out of scope.  It's undefined behaviour.



More information about the Gcc-bugs mailing list