From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6598 invoked by alias); 19 May 2005 23:27:41 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6552 invoked by alias); 19 May 2005 23:27:38 -0000 Date: Thu, 19 May 2005 23:27:00 -0000 Message-ID: <20050519232738.6551.qmail@sourceware.org> From: "gdr at integrable-solutions dot net" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050519212022.21672.igodard@pacbell.net> References: <20050519212022.21672.igodard@pacbell.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/21672] Loses temporary in complex expression X-Bugzilla-Reason: CC X-SW-Source: 2005-05/txt/msg02834.txt.bz2 List-Id: ------- 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" 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