This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19317] [4.0 Regression] removing a temporary return value when we cannot
- 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: 10 Jan 2005 04:52:40 -0000
- Subject: [Bug c++/19317] [4.0 Regression] removing a temporary return value when we cannot
- References: <20050107191510.19317.mueller@kde.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-10 04:52 -------
Yes this is defind. As 12.2P1 says:
"Temporaries of class types are created in various contexts: ... returning an rvalue (6.6.3) ..."
"Even when the creation of the temporary object is avoided (12.8), all semantic restrictions must be
respected as if the temporary object was created".
So we have to create a temporary variable for this return value in all three of my examples. Hmm, the c
example for all three does the correct thing and create a temporary variable.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19317