This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/26669] lost temporary
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Mar 2006 21:50:23 -0000
- Subject: [Bug c++/26669] lost temporary
- References: <bug-26669-6594@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-03-13 21:50 -------
Not a bug, you are returning a reference to a local variables in:
friend
const
T& operator << (T t, const Arg& s) { return t <<= s; }
friend
const
T& operator >> (T t, const Arg& s) { return t >>= s; }
If you change the return type to T instead of T&, this works correctly, this is
hard to warn about since >>= returns a reference to t.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26669