[Bug c++/21672] Loses temporary in complex expression

gdr at integrable-solutions dot net gcc-bugzilla@gcc.gnu.org
Fri May 20 00:12:00 GMT 2005


------- Additional Comments From gdr at integrable-solutions dot net  2005-05-20 00:12 -------
Subject: Re:  Loses temporary in complex expression

"igodard at pacbell dot net" <gcc-bugzilla@gcc.gnu.org> writes:

| In particular, once you get all the template armwaving out of it:
| 
| int& foo(int i) { return i; }
| 
| should warn and does not.

It does with my compiler:
% cat a.C && g++ -c -Wall a.C 

int& f(int i)
{
   return i;
}
a.C: In function 'int& f(int)':
a.C:2: warning: reference to local variable 'i' returned

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21672



More information about the Gcc-bugs mailing list