diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-11-30 23:32:50 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-12-01 15:00:33 +0000 |
commit | 056551414a328b427c4bf4955b9a3832f344685c (patch) | |
tree | d13b6156601699c3c45d360aceea73da5fa4320c /gcc/fold-const.c | |
parent | 74d14778e73dfda365b0ac71478efafd9ad91c2a (diff) | |
download | gcc-056551414a328b427c4bf4955b9a3832f344685c.zip gcc-056551414a328b427c4bf4955b9a3832f344685c.tar.gz gcc-056551414a328b427c4bf4955b9a3832f344685c.tar.bz2 |
libstdc++: Clear RB tree after moving elements [PR103501]
If the allocator-extended move constructor move-constructs each element
into the new container, the contents of the old container are left in
moved-from states. We cannot know if those states preserve the
container's ordering and uniqueness guarantees, so just erase all
moved-from elements.
libstdc++-v3/ChangeLog:
PR libstdc++/103501
* include/bits/stl_tree.h (_Rb_tree(_Rb_tree&&, false_type)):
Clear container if elements have been moved-from.
* testsuite/23_containers/map/allocator/move_cons.cc: Expect
moved-from container to be empty.
* testsuite/23_containers/multimap/allocator/move_cons.cc:
Likewise.
* testsuite/23_containers/multiset/allocator/103501.cc: New test.
* testsuite/23_containers/set/allocator/103501.cc: New test.
Diffstat (limited to 'gcc/fold-const.c')
0 files changed, 0 insertions, 0 deletions