This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/35969] GLIBCXX_DEBUG: list::merge triggers bad assert
- From: "greened at obbligato dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Apr 2008 04:16:23 -0000
- Subject: [Bug libstdc++/35969] GLIBCXX_DEBUG: list::merge triggers bad assert
- References: <bug-35969-14707@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from greened at obbligato dot org 2008-04-18 04:16 -------
Ok, the closest thing I could find is the 1998 draft standard:
http://www.kuzbass.ru:8086/docs/isocpp/lib-containers.html#lib.sequences
It says that splice "invalidates only the iterators and references to the
spliced elements." There is no statement about iterators for merge.
So it seems like the testcase is invalid not due to the merge but due to the
splices. GLIBCXX_DEBUG mode doesn't catch the problem with the splices since
the iterator is still considered valid after the splice. For example, the
second splce doesn't assert on an invalid iterator being passed to it.
Perhaps this was changed in the final standard. It seems odd to me that splice
and merge would invalidate iterators as iterator stability is a prime reason
for using std::list and these operations don't destroy any sequence values.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35969