re PR libstdc++/84998 (std::hash<std::bitset<N>> fails in Debug Mode)
authorFrançois Dumont <fdumont@gcc.gnu.org>
Tue, 20 Mar 2018 21:45:14 +0000 (21:45 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Tue, 20 Mar 2018 21:45:14 +0000 (21:45 +0000)
2018-03-20  François Dumont  <fdumont@gcc.gnu.org>

PR libstdc++/84998
* include/bits/stl_bvector.h: Fix std::hash friend declaration.
* include/std/bitset: Likewise.
* include/bits/stl_map.h (std::map<>): Fix _Rb_tree_merge_helper friend
declaration.
* include/bits/stl_multimap.h (std::multimap<>): Likewise.
* include/bits/stl_multiset.h (std::multiset<>): Likewise.
* include/bits/stl_set.h (std::set<>): Likewise.
* include/bits/unordered_map.h (std::unordered_map<>): Fix
_Hash_merge_helper friend declaration.
(std::unordered_multimap<>): Likewise.
* include/bits/unordered_set.h (std::unordered_set<>): Likewise.
(std::unordered_multiset<>): Likewise.

From-SVN: r258693

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_bvector.h
libstdc++-v3/include/bits/stl_map.h
libstdc++-v3/include/bits/stl_multimap.h
libstdc++-v3/include/bits/stl_multiset.h
libstdc++-v3/include/bits/stl_set.h
libstdc++-v3/include/bits/unordered_map.h
libstdc++-v3/include/bits/unordered_set.h
libstdc++-v3/include/debug/vector
libstdc++-v3/include/std/bitset

index 2c5c6c6c1efe95355edfed4ff094123b54f70466..7ac98fb2143717a4c8951278792119b0ac5a400b 100644 (file)
@@ -1,3 +1,19 @@
+2018-03-20  François Dumont  <fdumont@gcc.gnu.org>
+
+       PR libstdc++/84998
+       * include/bits/stl_bvector.h: Fix std::hash friend declaration.
+       * include/std/bitset: Likewise.
+       * include/bits/stl_map.h (std::map<>): Fix _Rb_tree_merge_helper friend
+       declaration.
+       * include/bits/stl_multimap.h (std::multimap<>): Likewise.
+       * include/bits/stl_multiset.h (std::multiset<>): Likewise.
+       * include/bits/stl_set.h (std::set<>): Likewise.
+       * include/bits/unordered_map.h (std::unordered_map<>): Fix
+       _Hash_merge_helper friend declaration.
+       (std::unordered_multimap<>): Likewise.
+       * include/bits/unordered_set.h (std::unordered_set<>): Likewise.
+       (std::unordered_multiset<>): Likewise.
+
 2018-03-19  Gerald Pfeifer  <gerald@pfeifer.com>
 
        * doc/xml/api.xml: www.fsf.org has moved to https. Also omit
@@ -8,7 +24,8 @@
        * doc/xml/manual/spine.xml: Ditto.
        * doc/xml/spine.xml: Ditto.
 
-2018-03-19  Gerald Pfeifer  <gerald@pfeifer.com>       
+2018-03-19  Gerald Pfeifer  <gerald@pfeifer.com>
+
        * doc/xml/manual/documentation_hacking.xml: Adjust link to
        docbook.org.
 
index 00a179f3a89634a6e709e3e9385325a9e63cc77b..de723edf50c509e1a1d1e234a4735b5743af626e 100644 (file)
@@ -58,6 +58,7 @@
 
 #if __cplusplus >= 201103L
 #include <initializer_list>
+#include <bits/functional_hash.h>
 #endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -591,7 +592,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       typedef typename _Base::_Bit_alloc_traits                _Bit_alloc_traits;
 
 #if __cplusplus >= 201103L
-      template<typename> friend struct hash;
+      friend struct std::hash<vector>;
 #endif
 
     public:
@@ -1313,8 +1314,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
 
 #if __cplusplus >= 201103L
 
-#include <bits/functional_hash.h>
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
index 24d7f422271bcb39abd8015866b4a5bbf5179138..a4a026ed34a6ac1b841c63ccb61998506f8afbbd 100644 (file)
@@ -633,7 +633,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); }
 
       template<typename, typename>
-       friend class _Rb_tree_merge_helper;
+       friend class std::_Rb_tree_merge_helper;
 
       template<typename _C2>
        void
index 38071fe7d12f355c14c9d4162472bb663d4d4de9..fc8f454723d425fa523ef6a54990717148425c3c 100644 (file)
@@ -651,7 +651,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return _M_t._M_reinsert_node_hint_equal(__hint, std::move(__nh)); }
 
       template<typename, typename>
-       friend class _Rb_tree_merge_helper;
+       friend class std::_Rb_tree_merge_helper;
 
       template<typename _C2>
        void
index 1039612fb047d6d7e5b07446e8d5c8456459dcc5..f41f56c9485f3f15aea55e515f59911f01e79d9b 100644 (file)
@@ -589,7 +589,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return _M_t._M_reinsert_node_hint_equal(__hint, std::move(__nh)); }
 
       template<typename, typename>
-       friend class _Rb_tree_merge_helper;
+       friend class std::_Rb_tree_merge_helper;
 
       template<typename _Compare1>
        void
index 0a40f0661c0c208e7cba287e3768750e7c84995b..2e332efa477fb5f67431d26d9f9a5fd1c1c61573 100644 (file)
@@ -604,7 +604,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); }
 
       template<typename, typename>
-       friend class _Rb_tree_merge_helper;
+       friend class std::_Rb_tree_merge_helper;
 
       template<typename _Compare1>
        void
index b757ff2a72c64cf03406e232eb025114058dc606..07aad9e5e1939a1e7a9d7766b206ea58a739befd 100644 (file)
@@ -862,7 +862,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #if __cplusplus > 201402L
       template<typename, typename, typename>
-       friend class _Hash_merge_helper;
+       friend class std::_Hash_merge_helper;
 
       template<typename _H2, typename _P2>
        void
@@ -1742,7 +1742,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #if __cplusplus > 201402L
       template<typename, typename, typename>
-       friend class _Hash_merge_helper;
+       friend class std::_Hash_merge_helper;
 
       template<typename _H2, typename _P2>
        void
index 77942a3c30618b86131e188bda493e771889746f..c9ac4ad57e3d8e5b960288cc123fa6a82ca8524c 100644 (file)
@@ -588,7 +588,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #if __cplusplus > 201402L
       template<typename, typename, typename>
-       friend class _Hash_merge_helper;
+       friend class std::_Hash_merge_helper;
 
       template<typename _H2, typename _P2>
        void
@@ -1368,7 +1368,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #if __cplusplus > 201402L
       template<typename, typename, typename>
-       friend class _Hash_merge_helper;
+       friend class std::_Hash_merge_helper;
 
       template<typename _H2, typename _P2>
        void
index fa79379f677dc43bb3c3020751395826c74f9b6a..5289265372875407b0285c08cec7927e30a5fae5 100644 (file)
@@ -770,6 +770,8 @@ namespace __debug
 } // namespace __debug
 
 #if __cplusplus >= 201103L
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
   // DR 1182.
   /// std::hash specialization for vector<bool>.
   template<typename _Alloc>
@@ -780,6 +782,8 @@ namespace __debug
       operator()(const __debug::vector<bool, _Alloc>& __b) const noexcept
       { return std::hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>()(__b); }
     };
+
+_GLIBCXX_END_NAMESPACE_VERSION
 #endif
 
 } // namespace std
index 630602d48e72e163e316153c17f1c171db3e8a63..e598ea312a79cc37d741c0bd13c1599e5f05a5a6 100644 (file)
 #include <iosfwd>
 #include <bits/cxxabi_forced.h>
 
+#if __cplusplus >= 201103L
+# include <bits/functional_hash.h>
+#endif
+
 #define _GLIBCXX_BITSET_BITS_PER_WORD  (__CHAR_BIT__ * __SIZEOF_LONG__)
 #define _GLIBCXX_BITSET_WORDS(__n) \
   ((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \
@@ -779,7 +783,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       }
 
 #if __cplusplus >= 201103L
-      template<typename> friend struct hash;
+      friend struct std::hash<bitset>;
 #endif
 
     public:
@@ -1549,8 +1553,6 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
 
 #if __cplusplus >= 201103L
 
-#include <bits/functional_hash.h>
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION