https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87135
--- Comment #2 from François Dumont <fdumont at gcc dot gnu.org> --- Author: fdumont Date: Tue Sep 18 20:36:16 2018 New Revision: 264413 URL: https://gcc.gnu.org/viewcvs?rev=264413&root=gcc&view=rev Log: 2018-09-18 François Dumont <fdum...@gcc.gnu.org> PR libstdc++/87135 * src/c++11/hashtable_c++0x.cc: (_Prime_rehash_policy::_M_next_bkt): Return a prime no smaller than requested size, but not necessarily greater. (_Prime_rehash_policy::_M_need_rehash): Rehash only if target size is strictly greater than next resize threshold. * testsuite/23_containers/unordered_map/modifiers/reserve.cc: Adapt test to validate that there is no rehash as long as number of insertion is lower or equal to the reserved number of elements. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/src/c++11/hashtable_c++0x.cc trunk/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/reserve.cc