]> git.ipfire.org Git - thirdparty/gcc.git/commit
re PR libstdc++/54296 (using the object in the map to erase element from the map...
authorFrançois Dumont <fdumont@gcc.gnu.org>
Wed, 5 Sep 2012 19:41:16 +0000 (19:41 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Wed, 5 Sep 2012 19:41:16 +0000 (19:41 +0000)
commit3157879227a4b4e1e0921483b067607fa48aa050
tree9f144135a489ba7ffa36c5d8d1fcd48b17eb1c51
parentb413068c9fd88857fee03d7e7cf966bc2add5a6f
re PR libstdc++/54296 (using the object in the map to erase element from the map crashes)

2012-09-05  François Dumont  <fdumont@gcc.gnu.org>

PR libstdc++/54296
* include/bits/hashtable.h (_M_erase(size_type, __node_base*,
__node_type*)): New.
(erase(const_iterator)): Use latter.
(_M_erase(std::true_type, const key_type&)): New, likewise.
(_M_erase(std::false_type, const key_type&)): New. Find all nodes
matching the key before deallocating them so that the key doesn't
get invalidated.
(erase(const key_type&)): Use the new member functions.
* testsuite/23_containers/unordered_map/erase/54296.cc: New.
* testsuite/23_containers/unordered_multimap/erase/54296.cc: New.

From-SVN: r190991
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/hashtable.h
libstdc++-v3/testsuite/23_containers/unordered_map/erase/54276.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/54276.cc [new file with mode: 0644]