summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-15 16:53:02 +0000
committerfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-15 16:53:02 +0000
commit40ec2913c4f06c20639b31fdceb428a32007ee04 (patch)
treeb8f30eb81b0ae54ff76b9857e1079c46a5bfb64d
parent19b58ae9b42d06e5df458e1bfa577163f6b1e8a5 (diff)
downloadppe42-gcc-40ec2913c4f06c20639b31fdceb428a32007ee04.tar.gz
ppe42-gcc-40ec2913c4f06c20639b31fdceb428a32007ee04.zip
2014-01-15 François Dumont <fdumont@gcc.gnu.org>
* include/bits/hashtable_policy.h: Fix some long lines. * include/bits/hashtable.h (__hash_code_base_access): Define and use it to check its _M_bucket_index noexcept qualification. Use also in place of... (__access_protected_ctor): ...this. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adapt line number. * testsuite/23_containers/unordered_set/ not_default_constructible_hash_neg.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206632 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog12
-rw-r--r--libstdc++-v3/include/bits/hashtable.h13
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h9
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/not_default_constructible_hash_neg.cc2
5 files changed, 27 insertions, 11 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 43c2900d0d7..4da658bf16f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,15 @@
+2014-01-15 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/hashtable_policy.h: Fix some long lines.
+ * include/bits/hashtable.h (__hash_code_base_access): Define and
+ use it to check its _M_bucket_index noexcept qualification. Use
+ also in place of...
+ (__access_protected_ctor): ...this.
+ * testsuite/23_containers/unordered_set/instantiation_neg.cc:
+ Adapt line number.
+ * testsuite/23_containers/unordered_set/
+ not_default_constructible_hash_neg.cc: Likewise.
+
2014-01-13 François Dumont <fdumont@gcc.gnu.org>
* include/debug/set.h (set): Implement C++11 allocator-aware
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index f2d51c682c9..e427c7f2383 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -260,9 +260,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Compile-time diagnostics.
+ // _Hash_code_base has everything protected, so use this derived type to
+ // access it.
+ struct __hash_code_base_access : __hash_code_base
+ { using __hash_code_base::_M_bucket_index; };
+
// Getting a bucket index from a node shall not throw because it is used
// in methods (erase, swap...) that shall not throw.
- static_assert(noexcept(declval<const _Hashtable&>()
+ static_assert(noexcept(declval<const __hash_code_base_access&>()
._M_bucket_index((const __node_type*)nullptr,
(std::size_t)0)),
"Cache the hash code or qualify your functors involved"
@@ -277,15 +282,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
"Functor used to map hash code to bucket index"
" must be default constructible");
- // _Hash_code_base has a protected default constructor, so use this
- // derived type to tell if it's usable.
- struct __access_protected_ctor : __hash_code_base { };
-
// When hash codes are not cached local iterator inherits from
// __hash_code_base above to compute node bucket index so it has to be
// default constructible.
static_assert(__if_hash_not_cached<
- is_default_constructible<__access_protected_ctor>>::value,
+ is_default_constructible<__hash_code_base_access>>::value,
"Cache the hash code or make functors involved in hash code"
" and bucket index computation default constructible");
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index f64d2d36159..e5aed59322d 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -161,7 +161,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__hashtable_alloc& _M_h;
};
- // Functor similar to the previous one but without any pool of node to recycle.
+ // Functor similar to the previous one but without any pool of nodes to
+ // recycle.
template<typename _NodeAlloc>
struct _AllocNode
{
@@ -1088,7 +1089,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::size_t
_M_bucket_index(const __node_type* __p, std::size_t __n) const
- noexcept( noexcept(declval<const _Hash&>()(declval<const _Key&>(), (std::size_t)0)) )
+ noexcept( noexcept(declval<const _Hash&>()(declval<const _Key&>(),
+ (std::size_t)0)) )
{ return _M_ranged_hash()(_M_extract()(__p->_M_v()), __n); }
void
@@ -1175,7 +1177,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::size_t
_M_bucket_index(const __node_type* __p, std::size_t __n) const
noexcept( noexcept(declval<const _H1&>()(declval<const _Key&>()))
- && noexcept(declval<const _H2&>()((__hash_code)0, (std::size_t)0)) )
+ && noexcept(declval<const _H2&>()((__hash_code)0,
+ (std::size_t)0)) )
{ return _M_h2()(_M_h1()(_M_extract()(__p->_M_v())), __n); }
void
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc
index e747e9cbf2d..83bc9d821e3 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/instantiation_neg.cc
@@ -19,7 +19,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "with noexcept" "" { target *-*-* } 265 }
+// { dg-error "with noexcept" "" { target *-*-* } 270 }
#include <unordered_set>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/not_default_constructible_hash_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/not_default_constructible_hash_neg.cc
index 991174c57f2..2365556767c 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/not_default_constructible_hash_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/not_default_constructible_hash_neg.cc
@@ -19,7 +19,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "default constructible" "" { target *-*-* } 287 }
+// { dg-error "default constructible" "" { target *-*-* } 288 }
#include <unordered_set>
OpenPOWER on IntegriCloud