aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2019-03-08 05:53:09 +0000
committerFrançois Dumont <fdumont@gcc.gnu.org>2019-03-08 05:53:09 +0000
commitc0cb38c28e6e667595a42caf0bc679d6029de06a (patch)
tree64e7912f5b72825ba6342756ef1b5bf1d0495a8e
parent20a4550ce01ab79ac7cd3412ce669cb9a032ca5e (diff)
downloadgcc-c0cb38c28e6e667595a42caf0bc679d6029de06a.zip
gcc-c0cb38c28e6e667595a42caf0bc679d6029de06a.tar.gz
gcc-c0cb38c28e6e667595a42caf0bc679d6029de06a.tar.bz2
re PR libstdc++/89477 (Incorrect CTAD deduction guides for set and multiset)
2019-03-08 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/89477 * include/debug/map.h (map): Use _RequireNotAllocator to constrain parameters in deduction guides. * include/debug/multimap.h (multimap): Likewise. * include/debug/set.h (multimap): Likewise. * include/debug/multiset.h (multimap): Likewise. * include/debug/unordered_map (unordered_map): Likewise. (unordered_multimap): Likewise. * include/debug/unordered_set (unordered_set): Likewise. (unordered_multiset): Likewise. From-SVN: r269479
-rw-r--r--libstdc++-v3/ChangeLog11
-rw-r--r--libstdc++-v3/include/debug/map.h54
-rw-r--r--libstdc++-v3/include/debug/multimap.h2
-rw-r--r--libstdc++-v3/include/debug/multiset.h52
-rw-r--r--libstdc++-v3/include/debug/set.h48
-rw-r--r--libstdc++-v3/include/debug/unordered_map15
-rw-r--r--libstdc++-v3/include/debug/unordered_set24
7 files changed, 125 insertions, 81 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index d98a591..9b876d0 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,16 @@
2019-03-08 François Dumont <fdumont@gcc.gnu.org>
+ PR libstdc++/89477
+ * include/debug/map.h (map): Use _RequireNotAllocator to constrain
+ parameters in deduction guides.
+ * include/debug/multimap.h (multimap): Likewise.
+ * include/debug/set.h (multimap): Likewise.
+ * include/debug/multiset.h (multimap): Likewise.
+ * include/debug/unordered_map (unordered_map): Likewise.
+ (unordered_multimap): Likewise.
+ * include/debug/unordered_set (unordered_set): Likewise.
+ (unordered_multiset): Likewise.
+
PR libstdc++/89608
* include/debug/unordered_map (unordered_map<>::_M_check_rehashed):
Invalidate all iterators in case of rehash.
diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h
index 5063325..80ca1be 100644
--- a/libstdc++-v3/include/debug/map.h
+++ b/libstdc++-v3/include/debug/map.h
@@ -700,34 +700,36 @@ namespace __debug
#if __cpp_deduction_guides >= 201606
- template<typename _InputIterator,
- typename _Compare = less<__iter_key_t<_InputIterator>>,
- typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
- typename = _RequireInputIter<_InputIterator>,
- typename = _RequireAllocator<_Allocator>>
- map(_InputIterator, _InputIterator,
- _Compare = _Compare(), _Allocator = _Allocator())
- -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
- _Compare, _Allocator>;
-
- template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
- typename _Allocator = allocator<pair<const _Key, _Tp>>,
- typename = _RequireAllocator<_Allocator>>
- map(initializer_list<pair<_Key, _Tp>>,
- _Compare = _Compare(), _Allocator = _Allocator())
- -> map<_Key, _Tp, _Compare, _Allocator>;
-
- template <typename _InputIterator, typename _Allocator,
+ template<typename _InputIterator,
+ typename _Compare = less<__iter_key_t<_InputIterator>>,
+ typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocator<_Compare>,
typename = _RequireAllocator<_Allocator>>
- map(_InputIterator, _InputIterator, _Allocator)
- -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
- less<__iter_key_t<_InputIterator>>, _Allocator>;
-
- template<typename _Key, typename _Tp, typename _Allocator,
- typename = _RequireAllocator<_Allocator>>
- map(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> map<_Key, _Tp, less<_Key>, _Allocator>;
+ map(_InputIterator, _InputIterator,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
+ _Compare, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
+ typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireNotAllocator<_Compare>,
+ typename = _RequireAllocator<_Allocator>>
+ map(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> map<_Key, _Tp, _Compare, _Allocator>;
+
+ template <typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ map(_InputIterator, _InputIterator, _Allocator)
+ -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
+ less<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ map(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> map<_Key, _Tp, less<_Key>, _Allocator>;
#endif
diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h
index 38659aa..560aa7d 100644
--- a/libstdc++-v3/include/debug/multimap.h
+++ b/libstdc++-v3/include/debug/multimap.h
@@ -585,6 +585,7 @@ namespace __debug
typename _Compare = less<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocator<_Compare>,
typename = _RequireAllocator<_Allocator>>
multimap(_InputIterator, _InputIterator,
_Compare = _Compare(), _Allocator = _Allocator())
@@ -593,6 +594,7 @@ namespace __debug
template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireNotAllocator<_Compare>,
typename = _RequireAllocator<_Allocator>>
multimap(initializer_list<pair<_Key, _Tp>>,
_Compare = _Compare(), _Allocator = _Allocator())
diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h
index 19dc8ea..8fb11f8 100644
--- a/libstdc++-v3/include/debug/multiset.h
+++ b/libstdc++-v3/include/debug/multiset.h
@@ -555,32 +555,34 @@ namespace __debug
typename _Allocator =
allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocator<_Compare>,
typename = _RequireAllocator<_Allocator>>
- multiset(_InputIterator, _InputIterator,
- _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<typename iterator_traits<_InputIterator>::value_type,
- _Compare, _Allocator>;
-
- template<typename _Key,
- typename _Compare = less<_Key>,
- typename _Allocator = allocator<_Key>,
- typename = _RequireAllocator<_Allocator>>
- multiset(initializer_list<_Key>,
- _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<_Key, _Compare, _Allocator>;
-
- template<typename _InputIterator, typename _Allocator,
- typename = _RequireInputIter<_InputIterator>,
- typename = _RequireAllocator<_Allocator>>
- multiset(_InputIterator, _InputIterator, _Allocator)
- -> multiset<typename iterator_traits<_InputIterator>::value_type,
- less<typename iterator_traits<_InputIterator>::value_type>,
- _Allocator>;
-
- template<typename _Key, typename _Allocator,
- typename = _RequireAllocator<_Allocator>>
- multiset(initializer_list<_Key>, _Allocator)
- -> multiset<_Key, less<_Key>, _Allocator>;
+ multiset(_InputIterator, _InputIterator,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> multiset<typename iterator_traits<_InputIterator>::value_type,
+ _Compare, _Allocator>;
+
+ template<typename _Key,
+ typename _Compare = less<_Key>,
+ typename _Allocator = allocator<_Key>,
+ typename = _RequireNotAllocator<_Compare>,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(initializer_list<_Key>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> multiset<_Key, _Compare, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(_InputIterator, _InputIterator, _Allocator)
+ -> multiset<typename iterator_traits<_InputIterator>::value_type,
+ less<typename iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _Key, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(initializer_list<_Key>, _Allocator)
+ -> multiset<_Key, less<_Key>, _Allocator>;
#endif
diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h
index 88b8490..9f16a91 100644
--- a/libstdc++-v3/include/debug/set.h
+++ b/libstdc++-v3/include/debug/set.h
@@ -567,31 +567,33 @@ namespace __debug
typename _Allocator =
allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocator<_Compare>,
typename = _RequireAllocator<_Allocator>>
set(_InputIterator, _InputIterator,
- _Compare = _Compare(), _Allocator = _Allocator())
- -> set<typename iterator_traits<_InputIterator>::value_type,
- _Compare, _Allocator>;
-
- template<typename _Key, typename _Compare = less<_Key>,
- typename _Allocator = allocator<_Key>,
- typename = _RequireAllocator<_Allocator>>
- set(initializer_list<_Key>,
- _Compare = _Compare(), _Allocator = _Allocator())
- -> set<_Key, _Compare, _Allocator>;
-
- template<typename _InputIterator, typename _Allocator,
- typename = _RequireInputIter<_InputIterator>,
- typename = _RequireAllocator<_Allocator>>
- set(_InputIterator, _InputIterator, _Allocator)
- -> set<typename iterator_traits<_InputIterator>::value_type,
- less<typename iterator_traits<_InputIterator>::value_type>,
- _Allocator>;
-
- template<typename _Key, typename _Allocator,
- typename = _RequireAllocator<_Allocator>>
- set(initializer_list<_Key>, _Allocator)
- -> set<_Key, less<_Key>, _Allocator>;
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> set<typename iterator_traits<_InputIterator>::value_type,
+ _Compare, _Allocator>;
+
+ template<typename _Key, typename _Compare = less<_Key>,
+ typename _Allocator = allocator<_Key>,
+ typename = _RequireNotAllocator<_Compare>,
+ typename = _RequireAllocator<_Allocator>>
+ set(initializer_list<_Key>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> set<_Key, _Compare, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ set(_InputIterator, _InputIterator, _Allocator)
+ -> set<typename iterator_traits<_InputIterator>::value_type,
+ less<typename iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _Key, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ set(initializer_list<_Key>, _Allocator)
+ -> set<_Key, less<_Key>, _Allocator>;
#endif
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index 0a7485d..d844ee9 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -651,6 +651,8 @@ namespace __debug
typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
+ typename = _RequireNotAllocator<_Pred>,
typename = _RequireAllocator<_Allocator>>
unordered_map(_InputIterator, _InputIterator,
typename unordered_map<int, int>::size_type = {},
@@ -662,6 +664,8 @@ namespace __debug
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
+ typename = _RequireNotAllocator<_Pred>,
typename = _RequireAllocator<_Allocator>>
unordered_map(initializer_list<pair<_Key, _Tp>>,
typename unordered_map<int, int>::size_type = {},
@@ -691,6 +695,7 @@ namespace __debug
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
typename = _RequireAllocator<_Allocator>>
unordered_map(_InputIterator, _InputIterator,
typename unordered_map<int, int>::size_type,
@@ -712,6 +717,7 @@ namespace __debug
-> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
template<typename _Key, typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
typename = _RequireAllocator<_Allocator>>
unordered_map(initializer_list<pair<_Key, _Tp>>,
typename unordered_map<int, int>::size_type,
@@ -752,7 +758,8 @@ namespace __debug
: public __gnu_debug::_Safe_container<
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>, _Alloc,
__gnu_debug::_Safe_unordered_container>,
- public _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
+ public _GLIBCXX_STD_C::unordered_multimap<
+ _Key, _Tp, _Hash, _Pred, _Alloc>
{
typedef _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash,
_Pred, _Alloc> _Base;
@@ -1250,6 +1257,8 @@ namespace __debug
typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
+ typename = _RequireNotAllocator<_Pred>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(_InputIterator, _InputIterator,
unordered_multimap<int, int>::size_type = {},
@@ -1262,6 +1271,8 @@ namespace __debug
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
+ typename = _RequireNotAllocator<_Pred>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>,
unordered_multimap<int, int>::size_type = {},
@@ -1290,6 +1301,7 @@ namespace __debug
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(_InputIterator, _InputIterator,
unordered_multimap<int, int>::size_type, _Hash,
@@ -1311,6 +1323,7 @@ namespace __debug
-> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
template<typename _Key, typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>,
unordered_multimap<int, int>::size_type,
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index a593143..ecc084e 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -533,12 +533,14 @@ namespace __debug
template<typename _InputIterator,
typename _Hash =
- hash<typename iterator_traits<_InputIterator>::value_type>,
+ hash<typename iterator_traits<_InputIterator>::value_type>,
typename _Pred =
- equal_to<typename iterator_traits<_InputIterator>::value_type>,
+ equal_to<typename iterator_traits<_InputIterator>::value_type>,
typename _Allocator =
- allocator<typename iterator_traits<_InputIterator>::value_type>,
+ allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
+ typename = _RequireNotAllocator<_Pred>,
typename = _RequireAllocator<_Allocator>>
unordered_set(_InputIterator, _InputIterator,
unordered_set<int>::size_type = {},
@@ -549,6 +551,8 @@ namespace __debug
template<typename _Tp, typename _Hash = hash<_Tp>,
typename _Pred = equal_to<_Tp>,
typename _Allocator = allocator<_Tp>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
+ typename = _RequireNotAllocator<_Pred>,
typename = _RequireAllocator<_Allocator>>
unordered_set(initializer_list<_Tp>,
unordered_set<int>::size_type = {},
@@ -569,6 +573,7 @@ namespace __debug
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
typename = _RequireAllocator<_Allocator>>
unordered_set(_InputIterator, _InputIterator,
unordered_set<int>::size_type,
@@ -586,6 +591,7 @@ namespace __debug
-> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
template<typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
typename = _RequireAllocator<_Allocator>>
unordered_set(initializer_list<_Tp>,
unordered_set<int>::size_type, _Hash, _Allocator)
@@ -1087,12 +1093,14 @@ namespace __debug
template<typename _InputIterator,
typename _Hash =
- hash<typename iterator_traits<_InputIterator>::value_type>,
+ hash<typename iterator_traits<_InputIterator>::value_type>,
typename _Pred =
- equal_to<typename iterator_traits<_InputIterator>::value_type>,
+ equal_to<typename iterator_traits<_InputIterator>::value_type>,
typename _Allocator =
- allocator<typename iterator_traits<_InputIterator>::value_type>,
+ allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
+ typename = _RequireNotAllocator<_Pred>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(_InputIterator, _InputIterator,
unordered_multiset<int>::size_type = {},
@@ -1104,6 +1112,8 @@ namespace __debug
template<typename _Tp, typename _Hash = hash<_Tp>,
typename _Pred = equal_to<_Tp>,
typename _Allocator = allocator<_Tp>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
+ typename = _RequireNotAllocator<_Pred>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(initializer_list<_Tp>,
unordered_multiset<int>::size_type = {},
@@ -1125,6 +1135,7 @@ namespace __debug
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(_InputIterator, _InputIterator,
unordered_multiset<int>::size_type,
@@ -1144,6 +1155,7 @@ namespace __debug
-> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
template<typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireNotAllocatorOrIntegral<_Hash>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(initializer_list<_Tp>,
unordered_multiset<int>::size_type, _Hash, _Allocator)