This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/37547] [c++0x] minmax with initializer_list gives incorrect results
- From: "paolo dot carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Sep 2008 17:35:05 -0000
- Subject: [Bug libstdc++/37547] [c++0x] minmax with initializer_list gives incorrect results
- References: <bug-37547-14909@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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