+2011-09-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/hashtable.h (_Hashtable<>::_Hashtable(_Hashtable&&)):
+ Remove noexcept, the move constructor allocates memory; rearrange
+ the code in the body to consistently update __ht._M_rehash_policy
+ before using _M_next_bkt on it.
+ * include/debug/unordered_map: Adjust.
+ * include/debug/unordered_set: Likewise.
+ * include/profile/unordered_map: Likewise.
+ * include/profile/unordered_set: Likewise.
+ * testsuite/23_containers/unordered_map/cons/
+ noexcept_move_construct.cc: Remove.
+ * testsuite/23_containers/unordered_set/cons/
+ noexcept_move_construct.cc: Likewise.
+ * testsuite/23_containers/unordered_multimap/cons/
+ noexcept_move_construct.cc: Likewise.
+ * testsuite/23_containers/unordered_multiset/cons/
+ noexcept_move_construct.cc: Likewise.
+
2011-08-31 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/chrono (operator*(const _Rep1&, const duration<>&)):
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
_Hashtable(_Hashtable&& __ht)
- noexcept(__and_<is_nothrow_copy_constructible<_Equal>,
- is_nothrow_copy_constructible<_H1>>::value)
: __detail::_Rehash_base<_RehashPolicy, _Hashtable>(__ht),
__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
_H1, _H2, _Hash, __chc>(__ht),
_M_element_count(__ht._M_element_count),
_M_rehash_policy(__ht._M_rehash_policy)
{
- size_type __n_bkt = __ht._M_rehash_policy._M_next_bkt(0);
- __ht._M_buckets = __ht._M_allocate_buckets(__n_bkt);
- __ht._M_bucket_count = __n_bkt;
+ __ht._M_rehash_policy = _RehashPolicy();
+ __ht._M_bucket_count = __ht._M_rehash_policy._M_next_bkt(0);
+ __ht._M_buckets = __ht._M_allocate_buckets(__ht._M_bucket_count);
__ht._M_begin_bucket_index = __ht._M_bucket_count;
__ht._M_element_count = 0;
- __ht._M_rehash_policy = _RehashPolicy();
}
template<typename _Key, typename _Value,
: _Base(__x) { }
unordered_map(unordered_map&& __x)
- noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
- is_nothrow_copy_constructible<_Pred>>::value)
: _Base(std::move(__x)) { }
unordered_map(initializer_list<value_type> __l,
: _Base(__x) { }
unordered_multimap(unordered_multimap&& __x)
- noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
- is_nothrow_copy_constructible<_Pred>>::value)
: _Base(std::move(__x)) { }
unordered_multimap(initializer_list<value_type> __l,
: _Base(__x) { }
unordered_set(unordered_set&& __x)
- noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
- is_nothrow_copy_constructible<_Pred>>::value)
: _Base(std::move(__x)) { }
unordered_set(initializer_list<value_type> __l,
: _Base(__x) { }
unordered_multiset(unordered_multiset&& __x)
- noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
- is_nothrow_copy_constructible<_Pred>>::value)
: _Base(std::move(__x)) { }
unordered_multiset(initializer_list<value_type> __l,
}
unordered_map(unordered_map&& __x)
- noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
- is_nothrow_copy_constructible<_Pred>>::value)
: _Base(std::move(__x))
{
__profcxx_hashtable_construct(this, _Base::bucket_count());
}
unordered_multimap(unordered_multimap&& __x)
- noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
- is_nothrow_copy_constructible<_Pred>>::value)
: _Base(std::move(__x))
{
__profcxx_hashtable_construct(this, _Base::bucket_count());
}
unordered_set(unordered_set&& __x)
- noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
- is_nothrow_copy_constructible<_Pred>>::value)
: _Base(std::move(__x))
{
__profcxx_hashtable_construct(this, _Base::bucket_count());
}
unordered_multiset(unordered_multiset&& __x)
- noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
- is_nothrow_copy_constructible<_Pred>>::value)
: _Base(std::move(__x))
{
__profcxx_hashtable_construct(this, _Base::bucket_count());
+++ /dev/null
-// { dg-do compile }
-// { dg-options "-std=gnu++0x" }
-
-// 2011-06-01 Paolo Carlini <paolo.carlini@oracle.com>
-//
-// Copyright (C) 2011 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <unordered_map>
-
-typedef std::unordered_map<int, int> umtype;
-
-static_assert(std::is_nothrow_move_constructible<umtype>::value, "Error");
+++ /dev/null
-// { dg-do compile }
-// { dg-options "-std=gnu++0x" }
-
-// 2011-06-01 Paolo Carlini <paolo.carlini@oracle.com>
-//
-// Copyright (C) 2011 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <unordered_map>
-
-typedef std::unordered_multimap<int, int> ummtype;
-
-static_assert(std::is_nothrow_move_constructible<ummtype>::value, "Error");
+++ /dev/null
-// { dg-do compile }
-// { dg-options "-std=gnu++0x" }
-
-// 2011-06-01 Paolo Carlini <paolo.carlini@oracle.com>
-//
-// Copyright (C) 2011 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <unordered_set>
-
-typedef std::unordered_multiset<int> umstype;
-
-static_assert(std::is_nothrow_move_constructible<umstype>::value, "Error");
+++ /dev/null
-// { dg-do compile }
-// { dg-options "-std=gnu++0x" }
-
-// 2011-06-01 Paolo Carlini <paolo.carlini@oracle.com>
-//
-// Copyright (C) 2011 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <unordered_set>
-
-typedef std::unordered_set<int> ustype;
-
-static_assert(std::is_nothrow_move_constructible<ustype>::value, "Error");