Hi

Here is a patch to fix _Hashtable Standard extension type which is almost unusable at the moment if instantiated with anything else that the types used for the std unordered containers that is to say __detail::_Default_ranged_hash and __detail::_Mod_range_hashing.

It is a really safe patch so I would propose it for current trunk but at the same time it only impacts a Standard extension and it hasn't been reported by anyone so just tell me when to apply it.

2014-03-21  François Dumont <fdum...@gcc.gnu.org>

    * include/bits/hashtable.h (_Hashtable(allocator_type)): Fix call
    to delegated constructor.
    (_Hashtable(size_type, _H1, key_equal, allocator_type)): Likewise.
    (_Hashtable<_It>(_It, _It, size_type, _H1, key_equal, allocator_type)):
    Likewise.
    (_Hashtable(
initializer_list, size_type, _H1, key_equal, allocator_type)): Likewise.

Tested under Linux x86_64.

François

Index: include/bits/hashtable.h
===================================================================
--- include/bits/hashtable.h	(revision 207322)
+++ include/bits/hashtable.h	(working copy)
@@ -372,9 +372,8 @@
       // Use delegating constructors.
       explicit
       _Hashtable(const allocator_type& __a)
-	: _Hashtable(10, _H1(), __detail::_Mod_range_hashing(),
-		     __detail::_Default_ranged_hash(), key_equal(),
-		     __key_extract(), __a)
+      : _Hashtable(10, _H1(), _H2(), _Hash(), key_equal(),
+		   __key_extract(), __a)
       { }
 
       explicit
@@ -382,8 +381,7 @@
 		 const _H1& __hf = _H1(),
 		 const key_equal& __eql = key_equal(),
 		 const allocator_type& __a = allocator_type())
-      : _Hashtable(__n, __hf, __detail::_Mod_range_hashing(),
-		   __detail::_Default_ranged_hash(), __eql,
+      : _Hashtable(__n, __hf, _H2(), _Hash(), __eql,
 		   __key_extract(), __a)
       { }
 
@@ -393,8 +391,7 @@
 		   const _H1& __hf = _H1(),
 		   const key_equal& __eql = key_equal(),
 		   const allocator_type& __a = allocator_type())
-	: _Hashtable(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
-		     __detail::_Default_ranged_hash(), __eql,
+	: _Hashtable(__f, __l, __n, __hf, _H2(), _Hash(), __eql,
 		     __key_extract(), __a)
 	{ }
 
@@ -403,9 +400,7 @@
 		 const _H1& __hf = _H1(),
 		 const key_equal& __eql = key_equal(),
 		 const allocator_type& __a = allocator_type())
-      : _Hashtable(__l.begin(), __l.end(), __n, __hf,
-		   __detail::_Mod_range_hashing(),
-		   __detail::_Default_ranged_hash(), __eql,
+      : _Hashtable(__l.begin(), __l.end(), __n, __hf, _H2(), _Hash(), __eql,
 		   __key_extract(), __a)
       { }
 

Reply via email to