--- Comment #5 from redi at gcc dot gnu dot org 2010-06-03 23:27 ---
see http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/ for more
details of copy elision and why it is a good thing
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44409
--- Comment #4 from redi at gcc dot gnu dot org 2010-06-03 23:23 ---
Good luck with that.
Your copy constructor doesn't copy the state of the source object. Complaints
like this usually only come up in unrealistic examples created to test a
compiler's behaviour. There are many, many si
--- Comment #3 from gcc at razorcam dot com 2010-06-03 23:04 ---
Thanks for your answers. From the above answers I understand that g++ respects
the ISO c++ standard, and thus you can consider this is not a bug. But this is
clearly an explicit call of the copy constructor, not an implicit
--- Comment #2 from redi at gcc dot gnu dot org 2010-06-03 22:42 ---
Yes, this is eligible for copy elision, see [class.copy]
when a temporary class object that has not been bound to a reference (12.2)
would be copied/moved
to a class object with the same cv-unqualified type, the copy/
--- Comment #1 from pinskia at gcc dot gnu dot org 2010-06-03 22:37 ---
I think this one case is where the copy constructor can be skipped.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44409