[Bug c++/19317] [4.0 Regression] removing a temporary return value when we cannot

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jan 10 04:52:00 GMT 2005


------- 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



More information about the Gcc-bugs mailing list