[Bug c++/986] g++ misses warning for & on temporary

driscoll at cs dot wisc dot edu gcc-bugzilla@gcc.gnu.org
Fri Aug 27 22:53:00 GMT 2010



------- Comment #28 from driscoll at cs dot wisc dot edu  2010-08-27 22:53 -------
> Your two functions are well defined as the scope of the temp is only lost
> after going out of scope.

I see "A reference is bound to a temporary object: the temporary object is
destroyed at the end of the reference's lifetime" at
<http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/cplr382.htm>
(as well as 12.2 para 5 in the standard) now... that's something I totally did
not know.

Thanks, and sorry for the spam.


-- 


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



More information about the Gcc-bugs mailing list