This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19199] [3.3/3.4/4.0 Regression] Wrong warning about returning a reference to a temporary
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Dec 2004 14:51:40 -0000
- Subject: [Bug c++/19199] [3.3/3.4/4.0 Regression] Wrong warning about returning a reference to a temporary
- References: <20041230105911.19199.lars@trolltech.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-31 14:51 -------
(In reply to comment #2)
> Why would this cause wrong code? It's just a cast from an enum to an int,
> I don't see what's wrong with that except that it's ugly.
>
> You have to actually show that this causes wrong code, not just make your
> usual exaggerated claims ;-)
Ok, the reason why it is wrong code is because we return an address to a temporary which we can
overwrite. Yes this is wrong code. The diagnostic is just an indication that it will be wrong code.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19199