[Bug c++/12667] [3.3 regression] max(enum) returns reference to temporary
gdr at integrable-solutions dot net
gcc-bugzilla@gcc.gnu.org
Wed Nov 19 04:23:00 GMT 2003
------- Additional Comments From gdr at integrable-solutions dot net 2003-11-19 04:23 -------
Subject: Re: [3.3 regression] max(enum) returns reference to temporary
"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| The code in comment #3 is definitely wrong. You call
| max(E1,E2)
| both E1 and E2 are names that when evaluated yield temporary variables. These
| temporaries are then bound to the constant references in the args to max, and
| you return a reference to a temporary from that function. The lifetime of the temporary
| ends at the end of the call expression,
No, the temporaries last until the end of the full expression.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12667
More information about the Gcc-bugs
mailing list