This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/986] g++ misses warning for & on temporary
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 May 2007 14:34:12 -0000
- Subject: [Bug c++/986] g++ misses warning for & on temporary
- References: <bug-986-184@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #13 from bangerth at dealii dot org 2007-05-08 15:34 -------
(In reply to comment #12)
> The summary says "g++ misses warning for & on temporary". But something that is
> always an error can be called a warning?
The point is that the standard doesn't call it an error, but undefined
behavior. It's perfectly legal to keep a reference to a temporary, it
may just not yield the result you had hoped for.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=986