This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[Patch] libstdc++/17012
- From: Paolo Carlini <pcarlini at suse dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 08 Feb 2007 16:48:44 +0100
- Subject: [Patch] libstdc++/17012
Hi,
assuming there are no objections, I mean to commit very soon Howard'
patch for this issue. Tested x86-linux.
Paolo.
PS: as regards the delicate point about types oveloading operator&, for
better or worse in our implementation we are already assuming everywhere
that &value is the address of value, therefore certainly we can do no
damage...
/////////////
2007-02-08 Howard Hinnant <hhinnant@apple.com>
PR libstdc++/17012
* include/bits/list.tcc (list<>::remove): Take care of
&*__first == &__value.
* docs/html/ext/howto.html: Add an entry for DR 526.
Index: docs/html/ext/howto.html
===================================================================
--- docs/html/ext/howto.html (revision 121710)
+++ docs/html/ext/howto.html (working copy)
@@ -586,6 +586,13 @@
<dd>Construct a <code>linear_congruential</code> engine and seed with it.
</dd>
+ <dt><a href="lwg-active.html#526">526</a>:
+ <em>Is it undefined if a function in the standard changes in
+ parameters?</em>
+ </dt>
+ <dd>Use &value.
+ </dd>
+
<dt><a href="lwg-defects.html#538">538</a>:
<em>241 again: Does unique_copy() require CopyConstructible
and Assignable?</em>
Index: include/bits/list.tcc
===================================================================
--- include/bits/list.tcc (revision 121710)
+++ include/bits/list.tcc (working copy)
@@ -1,6 +1,6 @@
// List implementation (out of line) -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -176,14 +176,25 @@
{
iterator __first = begin();
iterator __last = end();
+ iterator __extra = __last;
while (__first != __last)
{
iterator __next = __first;
++__next;
if (*__first == __value)
- _M_erase(__first);
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 526. Is it undefined if a function in the standard changes
+ // in parameters?
+ if (&*__first != &__value)
+ _M_erase(__first);
+ else
+ __extra = __first;
+ }
__first = __next;
}
+ if (__extra != __last)
+ _M_erase(__extra);
}
template<typename _Tp, typename _Alloc>