This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/52822] [C++11] stable_partition destroys sequence due to inappropriate self-move-assignment
- From: "jyasskin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 Apr 2012 22:26:08 +0000
- Subject: [Bug libstdc++/52822] [C++11] stable_partition destroys sequence due to inappropriate self-move-assignment
- Auto-submitted: auto-generated
- References: <bug-52822-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52822
--- Comment #11 from Jeffrey Yasskin <jyasskin at gcc dot gnu.org> 2012-04-12 22:26:08 UTC ---
Author: jyasskin
Date: Thu Apr 12 22:26:02 2012
New Revision: 186396
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186396
Log:
Fix PR52822 by explicitly checking for object identity before
move-assigning. This is a simpler fix than was committed to 4.7 and
4.8.
2012-04-12 Jeffrey Yasskin <jyasskin@google.com>
PR libstdc++/52822
* include/bits/stl_algo.h (__stable_partition_adaptive): Avoid
move-assigning an object to itself by explicitly testing for
identity.
* testsuite/25_algorithms/stable_partition/pr52822.cc: Test
vectors, which have a destructive self-move-assignment.
* testsuite/25_algorithms/stable_partition/moveable.cc (test02):
Test with rvalstruct, which explicitly checks
self-move-assignment.
Added:
branches/gcc-4_6-branch/libstdc++-v3/testsuite/25_algorithms/stable_partition/pr52822.cc
Modified:
branches/gcc-4_6-branch/libstdc++-v3/ChangeLog
branches/gcc-4_6-branch/libstdc++-v3/include/bits/stl_algo.h
branches/gcc-4_6-branch/libstdc++-v3/testsuite/25_algorithms/stable_partition/moveable.cc