This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/35969] GLIBCXX_DEBUG: list::merge triggers bad assert



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]