http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57207
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-05-08 11:30:43 UTC --- (In reply to comment #0) > Why const reference to temporary object (List) does not prolong life time of > temporary object (TByteArrayList() << TMyStruct())? Because (TByteArrayList() << TMyStruct()) is not a temporary object, it's a reference returned by operator<< The temporary object is TByteArrayList() and that is bound to the reference parameter of operator<< not to List, so as comment 1 says, the temporary does not have its lifetime extended. G++ is correct.