Commit 5dfb5e5b by François Dumont

re PR libstdc++/84998 (std::hash<std::bitset<N>> fails in Debug Mode)

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
parent 6f21dc3c
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> 2018-03-19 Gerald Pfeifer <gerald@pfeifer.com>
* doc/xml/api.xml: www.fsf.org has moved to https. Also omit * doc/xml/api.xml: www.fsf.org has moved to https. Also omit
...@@ -8,7 +24,8 @@ ...@@ -8,7 +24,8 @@
* doc/xml/manual/spine.xml: Ditto. * doc/xml/manual/spine.xml: Ditto.
* doc/xml/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 * doc/xml/manual/documentation_hacking.xml: Adjust link to
docbook.org. docbook.org.
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
#include <initializer_list> #include <initializer_list>
#include <bits/functional_hash.h>
#endif #endif
namespace std _GLIBCXX_VISIBILITY(default) namespace std _GLIBCXX_VISIBILITY(default)
...@@ -591,7 +592,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -591,7 +592,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef typename _Base::_Bit_alloc_traits _Bit_alloc_traits; typedef typename _Base::_Bit_alloc_traits _Bit_alloc_traits;
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename> friend struct hash; friend struct std::hash<vector>;
#endif #endif
public: public:
...@@ -1313,8 +1314,6 @@ _GLIBCXX_END_NAMESPACE_VERSION ...@@ -1313,8 +1314,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
#include <bits/functional_hash.h>
namespace std _GLIBCXX_VISIBILITY(default) namespace std _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
......
...@@ -633,7 +633,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -633,7 +633,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); } { return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); }
template<typename, typename> template<typename, typename>
friend class _Rb_tree_merge_helper; friend class std::_Rb_tree_merge_helper;
template<typename _C2> template<typename _C2>
void void
......
...@@ -651,7 +651,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -651,7 +651,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_t._M_reinsert_node_hint_equal(__hint, std::move(__nh)); } { return _M_t._M_reinsert_node_hint_equal(__hint, std::move(__nh)); }
template<typename, typename> template<typename, typename>
friend class _Rb_tree_merge_helper; friend class std::_Rb_tree_merge_helper;
template<typename _C2> template<typename _C2>
void void
......
...@@ -589,7 +589,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -589,7 +589,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_t._M_reinsert_node_hint_equal(__hint, std::move(__nh)); } { return _M_t._M_reinsert_node_hint_equal(__hint, std::move(__nh)); }
template<typename, typename> template<typename, typename>
friend class _Rb_tree_merge_helper; friend class std::_Rb_tree_merge_helper;
template<typename _Compare1> template<typename _Compare1>
void void
......
...@@ -604,7 +604,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -604,7 +604,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); } { return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); }
template<typename, typename> template<typename, typename>
friend class _Rb_tree_merge_helper; friend class std::_Rb_tree_merge_helper;
template<typename _Compare1> template<typename _Compare1>
void void
......
...@@ -862,7 +862,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -862,7 +862,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#if __cplusplus > 201402L #if __cplusplus > 201402L
template<typename, typename, typename> template<typename, typename, typename>
friend class _Hash_merge_helper; friend class std::_Hash_merge_helper;
template<typename _H2, typename _P2> template<typename _H2, typename _P2>
void void
...@@ -1742,7 +1742,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1742,7 +1742,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#if __cplusplus > 201402L #if __cplusplus > 201402L
template<typename, typename, typename> template<typename, typename, typename>
friend class _Hash_merge_helper; friend class std::_Hash_merge_helper;
template<typename _H2, typename _P2> template<typename _H2, typename _P2>
void void
......
...@@ -588,7 +588,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -588,7 +588,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#if __cplusplus > 201402L #if __cplusplus > 201402L
template<typename, typename, typename> template<typename, typename, typename>
friend class _Hash_merge_helper; friend class std::_Hash_merge_helper;
template<typename _H2, typename _P2> template<typename _H2, typename _P2>
void void
...@@ -1368,7 +1368,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1368,7 +1368,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#if __cplusplus > 201402L #if __cplusplus > 201402L
template<typename, typename, typename> template<typename, typename, typename>
friend class _Hash_merge_helper; friend class std::_Hash_merge_helper;
template<typename _H2, typename _P2> template<typename _H2, typename _P2>
void void
......
...@@ -770,6 +770,8 @@ namespace __debug ...@@ -770,6 +770,8 @@ namespace __debug
} // namespace __debug } // namespace __debug
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// DR 1182. // DR 1182.
/// std::hash specialization for vector<bool>. /// std::hash specialization for vector<bool>.
template<typename _Alloc> template<typename _Alloc>
...@@ -780,6 +782,8 @@ namespace __debug ...@@ -780,6 +782,8 @@ namespace __debug
operator()(const __debug::vector<bool, _Alloc>& __b) const noexcept operator()(const __debug::vector<bool, _Alloc>& __b) const noexcept
{ return std::hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>()(__b); } { return std::hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>()(__b); }
}; };
_GLIBCXX_END_NAMESPACE_VERSION
#endif #endif
} // namespace std } // namespace std
......
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
#include <iosfwd> #include <iosfwd>
#include <bits/cxxabi_forced.h> #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_BITS_PER_WORD (__CHAR_BIT__ * __SIZEOF_LONG__)
#define _GLIBCXX_BITSET_WORDS(__n) \ #define _GLIBCXX_BITSET_WORDS(__n) \
((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \ ((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \
...@@ -779,7 +783,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -779,7 +783,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
} }
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename> friend struct hash; friend struct std::hash<bitset>;
#endif #endif
public: public:
...@@ -1549,8 +1553,6 @@ _GLIBCXX_END_NAMESPACE_CONTAINER ...@@ -1549,8 +1553,6 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
#include <bits/functional_hash.h>
namespace std _GLIBCXX_VISIBILITY(default) namespace std _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment