[Bug c++/21672] Loses temporary in complex expression
gdr at integrable-solutions dot net
gcc-bugzilla@gcc.gnu.org
Thu May 19 23:27:00 GMT 2005
------- Additional Comments From gdr at integrable-solutions dot net 2005-05-19 23:27 -------
Subject: Re: Loses temporary in complex expression
"igodard at pacbell dot net" <gcc-bugzilla@gcc.gnu.org> writes:
| 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.
agreed.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21672
More information about the Gcc-bugs
mailing list