This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21672] Loses temporary in complex expression
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 May 2005 23:11:53 -0000
- Subject: [Bug c++/21672] Loses temporary in complex expression
- References: <20050519212022.21672.igodard@pacbell.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From igodard at pacbell dot net 2005-05-19 23:11 -------
Yes, the friend function is returning a reference to its own argument, though
that seems to disappear as the body gets inlined in *most* cases :-)
So please reopen this as a "missing warning" bug. In most cases of returning
a reference to a function local, like:
int& foo() { int i; return i; }
you get:
~/ootbc/members$ g++ foo.cc
foo.cc: In function `int& foo()':
foo.cc:1: warning: reference to local variable `i' returned
but apparently the warning logic overlooks the same problem when returning
arguments.
Ivan
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21672