[Bug libstdc++/37547] [c++0x] minmax with initializer_list gives incorrect results

paolo dot carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Wed Sep 17 17:36:00 GMT 2008



------- Comment #1 from paolo dot carlini at oracle dot com  2008-09-17 17:35 -------
Thanks for catching this early, apparently this is a fundamental issue with the
current proposal: having such overloads returning const refs to elements of the
initializer_list is a very bad idea, because the initializer_list goes away
upon function return. The important point here is that when the
initializer_list is build it contains a *copy* of v, not v itself, which thus
goes away when the initializer_list dies.

Let's fix the proposal... ;)


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-09-17 17:35:05
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37547



More information about the Gcc-bugs mailing list