]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR libstdc++/89477 constrain deduction guides for maps and sets
authorJonathan Wakely <jwakely@redhat.com>
Tue, 26 Feb 2019 23:12:44 +0000 (23:12 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 26 Feb 2019 23:12:44 +0000 (23:12 +0000)
The Compare, Hash, and Pred template parameters should be constrained in
the C++17 deduction guides for associative and unordered containers.

The deduction guides for stack, queue and priority_queue are already
constrained, but this patch makes them use the _RequireNotAllocator
helper instead of reproducing the logic each time.

PR libstdc++/89477
* include/bits/alloc_traits.h (_RequireNotAllocator): New helper for
container deduction guides.
* include/bits/hashtable.h (_RequireNotAllocatorOrIntegral): Likewise.
* include/bits/stl_map.h (map): Use _RequireNotAllocator to constrain
parameters in deduction guides.
* include/bits/stl_multimap.h (multimap): Likewise.
* include/bits/stl_multiset.h (multiset): Likewise.
* include/bits/stl_queue.h (queue, priority_queue): Likewise.
* include/bits/stl_set.h (set): Likewise.
* include/bits/stl_stack.h (stack): Likewise.
* include/bits/unordered_map.h (unordered_map, unordered_multimap):
use _RequireNotAllocator and _RequireNotAllocatorOrIntegral to
constrain parameters in deduction guides.
* include/bits/unordered_set.h (unordered_set, unordered_multiset):
Likewise.
* testsuite/23_containers/map/cons/deduction.cc: Test additional
deduction cases.
* testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
* testsuite/23_containers/set/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_multimap/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.

From-SVN: r269234

18 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/alloc_traits.h
libstdc++-v3/include/bits/hashtable.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_queue.h
libstdc++-v3/include/bits/stl_set.h
libstdc++-v3/include/bits/stl_stack.h
libstdc++-v3/include/bits/unordered_map.h
libstdc++-v3/include/bits/unordered_set.h
libstdc++-v3/testsuite/23_containers/map/cons/deduction.cc
libstdc++-v3/testsuite/23_containers/multiset/cons/deduction.cc
libstdc++-v3/testsuite/23_containers/set/cons/deduction.cc
libstdc++-v3/testsuite/23_containers/unordered_map/cons/deduction.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/deduction.cc
libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/deduction.cc
libstdc++-v3/testsuite/23_containers/unordered_set/cons/deduction.cc

index d6ae3226effbcfa3a787b5a721b790a1117ca22d..e2f44b3d20b50833242a067403ce0f48136c704b 100644 (file)
@@ -1,5 +1,32 @@
 2019-02-26  Jonathan Wakely  <jwakely@redhat.com>
 
+       PR libstdc++/89477
+       * include/bits/alloc_traits.h (_RequireNotAllocator): New helper for
+       container deduction guides.
+       * include/bits/hashtable.h (_RequireNotAllocatorOrIntegral): Likewise.
+       * include/bits/stl_map.h (map): Use _RequireNotAllocator to constrain
+       parameters in deduction guides.
+       * include/bits/stl_multimap.h (multimap): Likewise.
+       * include/bits/stl_multiset.h (multiset): Likewise.
+       * include/bits/stl_queue.h (queue, priority_queue): Likewise.
+       * include/bits/stl_set.h (set): Likewise.
+       * include/bits/stl_stack.h (stack): Likewise.
+       * include/bits/unordered_map.h (unordered_map, unordered_multimap):
+       use _RequireNotAllocator and _RequireNotAllocatorOrIntegral to
+       constrain parameters in deduction guides.
+       * include/bits/unordered_set.h (unordered_set, unordered_multiset):
+       Likewise.
+       * testsuite/23_containers/map/cons/deduction.cc: Test additional
+       deduction cases.
+       * testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
+       * testsuite/23_containers/set/cons/deduction.cc: Likewise.
+       * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
+       * testsuite/23_containers/unordered_multimap/cons/deduction.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_multiset/cons/deduction.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.
+
        PR libstdc++/89416
        * include/bits/alloc_traits.h (__is_alloc_insertable_impl): Change
        to class template and partial specialization using void_t.
index b8689daf74b7623f2fc820010cf87cb26fa255b6..cda768bf391b12c956582d40cd179978c564356d 100644 (file)
@@ -634,6 +634,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     using _RequireAllocator
       = typename enable_if<__is_allocator<_Alloc>::value, _Alloc>::type;
 
+  template<typename _Alloc>
+    using _RequireNotAllocator
+      = typename enable_if<!__is_allocator<_Alloc>::value, _Alloc>::type;
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif // C++11
index 31794fb12c2519ae1c71eb004507b45e5e9805fc..4737247994ac6f30209a4b72e4f15f9f8ec39bc0 100644 (file)
@@ -2214,6 +2214,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename, typename, typename> class _Hash_merge_helper { };
 #endif // C++17
 
+#if __cpp_deduction_guides >= 201606
+  // Used to constrain deduction guides
+  template<typename _Hash>
+    using _RequireNotAllocatorOrIntegral
+      = __enable_if_t<!__or_<is_integral<_Hash>, __is_allocator<_Hash>>::value>;
+#endif
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
index a61d23cac680d392beb0520ce1078fd7e3ad351d..322d0a8290af8204685f2fbd7ed69f27bed8dbc6 100644 (file)
@@ -1411,6 +1411,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
           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,
        _Compare = _Compare(), _Allocator = _Allocator())
@@ -1419,6 +1420,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   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())
index 29a96d8a45bc2b98df8d44e49d7f4df189bde21f..4c4ccad3ac00e88ece7d72ba296e9f26b7919512 100644 (file)
@@ -1075,6 +1075,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
           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())
@@ -1083,6 +1084,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   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())
index 7a0fb832480566ba210d4be1ba989894805444cc..af733ea34dca0847a2f1b021b784ff766eb962c3 100644 (file)
@@ -917,32 +917,34 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
           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
 
index dd1d5d9727a25397f20a63984d43dae6f81374d7..f7b2d3ad235cf2d89bbb263853e74043ada6f865 100644 (file)
@@ -312,12 +312,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cpp_deduction_guides >= 201606
   template<typename _Container,
-          typename = enable_if_t<!__is_allocator<_Container>::value>>
+          typename = _RequireNotAllocator<_Container>>
     queue(_Container) -> queue<typename _Container::value_type, _Container>;
 
   template<typename _Container, typename _Allocator,
-          typename = enable_if_t<!__is_allocator<_Container>::value>,
-          typename = enable_if_t<__is_allocator<_Allocator>::value>>
+          typename = _RequireNotAllocator<_Container>,
+          typename = _RequireAllocator<_Allocator>>
     queue(_Container, _Allocator)
     -> queue<typename _Container::value_type, _Container>;
 #endif
@@ -687,8 +687,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cpp_deduction_guides >= 201606
   template<typename _Compare, typename _Container,
-          typename = enable_if_t<!__is_allocator<_Compare>::value>,
-          typename = enable_if_t<!__is_allocator<_Container>::value>>
+          typename = _RequireNotAllocator<_Compare>,
+          typename = _RequireNotAllocator<_Container>>
     priority_queue(_Compare, _Container)
     -> priority_queue<typename _Container::value_type, _Container, _Compare>;
 
@@ -697,16 +697,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
           typename _Compare = less<_ValT>,
           typename _Container = vector<_ValT>,
           typename = _RequireInputIter<_InputIterator>,
-          typename = enable_if_t<!__is_allocator<_Compare>::value>,
-          typename = enable_if_t<!__is_allocator<_Container>::value>>
+          typename = _RequireNotAllocator<_Compare>,
+          typename = _RequireNotAllocator<_Container>>
     priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(),
                   _Container = _Container())
     -> priority_queue<_ValT, _Container, _Compare>;
 
   template<typename _Compare, typename _Container, typename _Allocator,
-          typename = enable_if_t<!__is_allocator<_Compare>::value>,
-          typename = enable_if_t<!__is_allocator<_Container>::value>,
-          typename = enable_if_t<__is_allocator<_Allocator>::value>>
+          typename = _RequireNotAllocator<_Compare>,
+          typename = _RequireNotAllocator<_Container>,
+          typename = _RequireAllocator<_Allocator>>
     priority_queue(_Compare, _Container, _Allocator)
     -> priority_queue<typename _Container::value_type, _Container, _Compare>;
 #endif
index 7c903cf3a9a3f46fc6afbe1d538761cfc8f0c654..3131a7974b0bcb55fb149c9044d9f81ff883be39 100644 (file)
@@ -934,6 +934,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
           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())
@@ -942,6 +943,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   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())
index 28faab2e8716ce8a5cc1e77e64118b86754e44ec..7b5f8ca482a9c3c1450fcda445b99434e0daf196 100644 (file)
@@ -286,12 +286,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cpp_deduction_guides >= 201606
   template<typename _Container,
-          typename = enable_if_t<!__is_allocator<_Container>::value>>
+          typename = _RequireNotAllocator<_Container>>
     stack(_Container) -> stack<typename _Container::value_type, _Container>;
 
   template<typename _Container, typename _Allocator,
-          typename = enable_if_t<!__is_allocator<_Container>::value>,
-          typename = enable_if_t<__is_allocator<_Allocator>::value>>
+          typename = _RequireNotAllocator<_Container>,
+          typename = _RequireAllocator<_Allocator>>
     stack(_Container, _Allocator)
     -> stack<typename _Container::value_type, _Container>;
 #endif
index ecb3ef411fc3a2bdde99891a3361a0fa3c1bb475..b8243a73445a7e5b5ebc1d14e18ffa9fec81ff9c 100644 (file)
@@ -1145,6 +1145,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
           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 = {},
@@ -1156,6 +1158,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   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 = {},
@@ -1185,6 +1189,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   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,
@@ -1206,6 +1211,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     -> 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,
@@ -1991,6 +1997,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
           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 = {},
@@ -2003,6 +2011,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   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 = {},
@@ -2031,6 +2041,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   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,
@@ -2052,6 +2063,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     -> 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,
index 3e1180f323adefe16d02c443d13d12d0512e7de4..8ebcaf4026397f5f695feb97418baec1520b8094 100644 (file)
@@ -820,12 +820,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   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 = {},
@@ -836,6 +838,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   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 = {},
@@ -856,6 +860,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   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,
@@ -873,6 +878,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     -> 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)
@@ -1608,12 +1614,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   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 = {},
@@ -1625,6 +1633,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   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 = {},
@@ -1646,6 +1656,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   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,
@@ -1665,6 +1676,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     -> 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)
index f4195257e9c18c93ffb1a754039776a943e965db..a42d8d6b8810bcf85549b138befe2834c7ef28ae 100644 (file)
@@ -44,6 +44,23 @@ static_assert(std::is_same_v<
              decltype(std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}, {}}),
              std::map<int, double>>);
 
+/* This is not deducible, ambiguous candidates:
+ * map(initializer_list<value_type>, const Compare&, const _Allocator& = {})
+ * map(initializer_list<value_type>, const _Allocator&)
+ * map(initializer_list<pair<Key, T>>, const _Allocator&) -> map
+static_assert(std::is_same_v<
+             decltype(std::map{{value_type{1, 2.0}, {2, 3.0}, {3, 4.0}},
+                               SimpleAllocator<value_type>{}}),
+             std::map<int, double, std::less<int>,
+                      SimpleAllocator<value_type>>>);
+*/
+
+static_assert(std::is_same_v<
+             decltype(std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+                               SimpleAllocator<value_type>{}}),
+             std::map<int, double, std::less<int>,
+                      SimpleAllocator<value_type>>>);
+
 static_assert(std::is_same_v<
              decltype(std::map{{value_type{1, 2.0}, {2, 3.0}, {3, 4.0}},
                                {}, SimpleAllocator<value_type>{}}),
@@ -79,6 +96,17 @@ void f()
                                  {})),
                std::map<int, double>>);
 
+  static_assert(std::is_same_v<
+               decltype(std::map{x.begin(), x.end(),
+                                 std::allocator<value_type>{}}),
+               std::map<int, double>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::map{x.begin(), x.end(),
+                                 SimpleAllocator<value_type>{}}),
+               std::map<int, double, std::less<int>,
+                        SimpleAllocator<value_type>>>);
+
   static_assert(std::is_same_v<
                decltype(std::map{x.begin(), x.end(),
                                  {},
@@ -121,6 +149,17 @@ void g()
                                  {})),
                std::map<int, double>>);
 
+  static_assert(std::is_same_v<
+               decltype(std::map{x.begin(), x.end(),
+                                 std::allocator<value_type>{}}),
+               std::map<int, double>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::map{x.begin(), x.end(),
+                                 SimpleAllocator<value_type>{}}),
+               std::map<int, double, std::less<int>,
+                        SimpleAllocator<value_type>>>);
+
   static_assert(std::is_same_v<
                decltype(std::map{x.begin(), x.end(),
                                  {},
@@ -160,6 +199,17 @@ void h()
                                  {})),
                std::map<int, double>>);
 
+  static_assert(std::is_same_v<
+               decltype(std::map{x.begin(), x.end(),
+                                 std::allocator<value_type>{}}),
+               std::map<int, double>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::map{x.begin(), x.end(),
+                                 SimpleAllocator<value_type>{}}),
+               std::map<int, double, std::less<int>,
+                        SimpleAllocator<value_type>>>);
+
   static_assert(std::is_same_v<
                decltype(std::map{x.begin(), x.end(),
                                  {},
index 4ca3f98129a0313fe5dbd3d5a45949e972ae63ad..6fe2704da179d5eea5f1db297ee06b46adac11c0 100644 (file)
@@ -3,8 +3,10 @@
 
 #include <set>
 #include <testsuite_allocator.h>
+#include <testsuite_iterators.h>
 
 using __gnu_test::SimpleAllocator;
+using value_type = std::multiset<int>::value_type;
 
 static_assert(std::is_same_v<
              decltype(std::multiset{1, 2, 3}),
@@ -15,20 +17,20 @@ static_assert(std::is_same_v<
              std::multiset<int>>);
 
 static_assert(std::is_same_v<
-             decltype(std::multiset{{1, 2, 3},
-                   std::less<int>{}, {}}),
+             decltype(std::multiset{{1, 2, 3}, std::less<int>{}, {}}),
              std::multiset<int>>);
 
 static_assert(std::is_same_v<
-             decltype(std::multiset{{1, 2, 3},
-                   {}}),
+             decltype(std::multiset{{1, 2, 3}, {}}),
              std::multiset<int>>);
 
 static_assert(std::is_same_v<
-             decltype(std::multiset{{1, 2, 3},
-                   {}, SimpleAllocator<int>{}}),
-             std::multiset<int, std::less<int>,
-             SimpleAllocator<int>>>);
+             decltype(std::multiset{{1, 2, 3}, SimpleAllocator<int>{}}),
+             std::multiset<int, std::less<int>, SimpleAllocator<int>>>);
+
+static_assert(std::is_same_v<
+             decltype(std::multiset{{1, 2, 3}, {}, SimpleAllocator<int>{}}),
+             std::multiset<int, std::less<int>, SimpleAllocator<int>>>);
 
 void f()
 {
@@ -54,6 +56,16 @@ void f()
                                  {})),
                std::multiset<int>>);
 
+  static_assert(std::is_same_v<
+               decltype(std::multiset{x.begin(), x.end(),
+                                      std::allocator<int>{}}),
+               std::multiset<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::multiset{x.begin(), x.end(),
+                                      SimpleAllocator<int>{}}),
+               std::multiset<int, std::less<int>, SimpleAllocator<int>>>);
+
   static_assert(std::is_same_v<
                decltype(std::multiset{x.begin(), x.end(),
                      {},
@@ -66,3 +78,56 @@ void f()
                      SimpleAllocator<int>{}}),
                std::multiset<int, std::less<int>, SimpleAllocator<int>>>);
 }
+
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+
+void g()
+{
+  value_type array[1];
+  test_container<value_type, input_iterator_wrapper> x(array);
+
+  static_assert(std::is_same_v<
+               decltype(std::multiset(x.begin(), x.end())),
+               std::multiset<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::multiset{x.begin(), x.end(),
+                                 std::less<int>{},
+                                 std::allocator<value_type>{}}),
+               std::multiset<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::multiset{x.begin(), x.end(),
+                                 std::less<int>{}, {}}),
+               std::multiset<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::multiset(x.begin(), x.end(),
+                                 {})),
+               std::multiset<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::multiset{x.begin(), x.end(),
+                                 std::allocator<value_type>{}}),
+               std::multiset<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::multiset{x.begin(), x.end(),
+                                 SimpleAllocator<value_type>{}}),
+               std::multiset<int, std::less<int>,
+                        SimpleAllocator<value_type>>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::multiset{x.begin(), x.end(),
+                                 {},
+                                 std::allocator<value_type>{}}),
+               std::multiset<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::multiset{x.begin(), x.end(),
+                                 {},
+                                 SimpleAllocator<value_type>{}}),
+               std::multiset<int, std::less<int>,
+                        SimpleAllocator<value_type>>>);
+}
index 73d5cfdd227a33dcf6e4c69065c21a0eebda4380..df89fa28dd008f0d1ad5d6f423ae7e492c2c6176 100644 (file)
@@ -3,8 +3,10 @@
 
 #include <set>
 #include <testsuite_allocator.h>
+#include <testsuite_iterators.h>
 
 using __gnu_test::SimpleAllocator;
+using value_type = std::set<int>::value_type;
 
 static_assert(std::is_same_v<
              decltype(std::set{1, 2, 3}),
@@ -24,6 +26,12 @@ static_assert(std::is_same_v<
                    {}}),
              std::set<int>>);
 
+static_assert(std::is_same_v<
+             decltype(std::set{{1, 2, 3},
+                   SimpleAllocator<int>{}}),
+             std::set<int, std::less<int>,
+             SimpleAllocator<int>>>);
+
 static_assert(std::is_same_v<
              decltype(std::set{{1, 2, 3},
                    {}, SimpleAllocator<int>{}}),
@@ -60,9 +68,67 @@ void f()
                      std::allocator<int>{}}),
                std::set<int>>);
 
+  static_assert(std::is_same_v<
+               decltype(std::set{x.begin(), x.end(),
+                                 SimpleAllocator<int>{}}),
+               std::set<int, std::less<int>, SimpleAllocator<int>>>);
+
   static_assert(std::is_same_v<
                decltype(std::set{x.begin(), x.end(),
                      {},
                      SimpleAllocator<int>{}}),
                std::set<int, std::less<int>, SimpleAllocator<int>>>);
 }
+
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+
+void g()
+{
+  value_type array[1];
+  test_container<value_type, input_iterator_wrapper> x(array);
+
+  static_assert(std::is_same_v<
+               decltype(std::set(x.begin(), x.end())),
+               std::set<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::set{x.begin(), x.end(),
+                                 std::less<int>{},
+                                 std::allocator<value_type>{}}),
+               std::set<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::set{x.begin(), x.end(),
+                                 std::less<int>{}, {}}),
+               std::set<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::set(x.begin(), x.end(),
+                                 {})),
+               std::set<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::set{x.begin(), x.end(),
+                                 std::allocator<value_type>{}}),
+               std::set<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::set{x.begin(), x.end(),
+                                 SimpleAllocator<value_type>{}}),
+               std::set<int, std::less<int>,
+                        SimpleAllocator<value_type>>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::set{x.begin(), x.end(),
+                                 {},
+                                 std::allocator<value_type>{}}),
+               std::set<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::set{x.begin(), x.end(),
+                                 {},
+                                 SimpleAllocator<value_type>{}}),
+               std::set<int, std::less<int>,
+                        SimpleAllocator<value_type>>>);
+}
index 1905b20116bf0585b3bca8024fbb5f2c55b03ad3..979a56c9497663465bff16cddc7c497508e00eb6 100644 (file)
@@ -16,6 +16,12 @@ static_assert(std::is_same_v<
                      {2, 3.0}, {3, 4.0}}}),
              std::unordered_map<int, double>>);
 
+static_assert(std::is_same_v<
+             decltype(std::unordered_map{
+               {std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+               1}),
+             std::unordered_map<int, double>>);
+
 static_assert(std::is_same_v<
              decltype(std::unordered_map{{std::pair{1, 2.0},
                      {2, 3.0}, {3, 4.0}},
@@ -41,6 +47,7 @@ static_assert(std::is_same_v<
 void f()
 {
   std::unordered_map<int, double> x;
+
   static_assert(std::is_same_v<
                decltype(std::unordered_map(x.begin(), x.end())),
                std::unordered_map<int, double>>);
@@ -58,9 +65,41 @@ void f()
   
   static_assert(std::is_same_v<
                decltype(std::unordered_map(x.begin(), x.end(),
-                                 {})),
+                     {})),
+               std::unordered_map<int, double>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_map{x.begin(), x.end(), 1}),
+               std::unordered_map<int, double>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_map{x.begin(), x.end(),
+                     1,
+                     std::allocator<std::pair<const int, double>>{}}),
                std::unordered_map<int, double>>);
 
+  static_assert(std::is_same_v<
+               decltype(std::unordered_map{x.begin(), x.end(),
+                     1,
+                     SimpleAllocator<std::pair<const int, double>>{}}),
+               std::unordered_map<int, double, std::hash<int>,
+               std::equal_to<int>,
+               SimpleAllocator<std::pair<const int, double>>>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_map{x.begin(), x.end(),
+                     1, std::hash<int>{},
+                     std::allocator<std::pair<const int, double>>{}}),
+               std::unordered_map<int, double>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_map{x.begin(), x.end(),
+                     1, std::hash<int>{},
+                     SimpleAllocator<std::pair<const int, double>>{}}),
+               std::unordered_map<int, double, std::hash<int>,
+               std::equal_to<int>,
+               SimpleAllocator<std::pair<const int, double>>>>);
+
   static_assert(std::is_same_v<
                decltype(std::unordered_map{x.begin(), x.end(),
                      {}, {}, {},
index db5e32b4ad2792e39d3c9d13b78613dfce264e7f..72b2d07149aa077aeed43842d023b73d023a3cb2 100644 (file)
@@ -29,10 +29,25 @@ static_assert(std::is_same_v<
              std::unordered_multimap<int, double>>);
 
 static_assert(std::is_same_v<
-             decltype(std::unordered_multimap{{std::pair{1, 2.0},
-                     {2, 3.0}, {3, 4.0}},
-                   {}, {}, {},
-                   SimpleAllocator<std::pair<const int, double>>{}}),
+             decltype(std::unordered_multimap{
+               {std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+               1, std::hash<int>{}}),
+             std::unordered_multimap<int, double>>);
+
+static_assert(std::is_same_v<
+             decltype(std::unordered_multimap{
+               {std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+               1, std::hash<int>{},
+               SimpleAllocator<std::pair<const int, double>>{}}),
+             std::unordered_multimap<int, double, std::hash<int>,
+             std::equal_to<int>,
+             SimpleAllocator<std::pair<const int, double>>>>);
+
+static_assert(std::is_same_v<
+             decltype(std::unordered_multimap{
+               {std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+               {}, {}, {},
+               SimpleAllocator<std::pair<const int, double>>{}}),
              std::unordered_multimap<int, double, std::hash<int>,
              std::equal_to<int>,
              SimpleAllocator<std::pair<const int, double>>>>);
@@ -41,6 +56,7 @@ static_assert(std::is_same_v<
 void f()
 {
   std::unordered_multimap<int, double> x;
+
   static_assert(std::is_same_v<
                decltype(std::unordered_multimap(x.begin(), x.end())),
                std::unordered_multimap<int, double>>);
@@ -61,6 +77,38 @@ void f()
                                  {})),
                std::unordered_multimap<int, double>>);
 
+  static_assert(std::is_same_v<
+               decltype(std::unordered_multimap(x.begin(), x.end(), 1)),
+               std::unordered_multimap<int, double>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_multimap{x.begin(), x.end(),
+                     {},
+                     std::allocator<std::pair<const int, double>>{}}),
+               std::unordered_multimap<int, double>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_multimap{x.begin(), x.end(),
+                     {},
+                     SimpleAllocator<std::pair<const int, double>>{}}),
+               std::unordered_multimap<int, double, std::hash<int>,
+               std::equal_to<int>,
+               SimpleAllocator<std::pair<const int, double>>>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_multimap{x.begin(), x.end(),
+                     1, std::hash<int>{},
+                     std::allocator<std::pair<const int, double>>{}}),
+               std::unordered_multimap<int, double>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_multimap{x.begin(), x.end(),
+                     1, std::hash<int>{},
+                     SimpleAllocator<std::pair<const int, double>>{}}),
+               std::unordered_multimap<int, double, std::hash<int>,
+               std::equal_to<int>,
+               SimpleAllocator<std::pair<const int, double>>>>);
+
   static_assert(std::is_same_v<
                decltype(std::unordered_multimap{x.begin(), x.end(),
                      {}, {}, {},
index 352176d1e7dbcb825616bfff06971a81047e848c..fa895d7ff54900ea42baf0e791e66b7154a8c6f6 100644 (file)
@@ -11,19 +11,44 @@ static_assert(std::is_same_v<
              std::unordered_multiset<int>>);
 
 static_assert(std::is_same_v<
-             decltype(std::unordered_multiset{1, 2, 3}),
+             decltype(std::unordered_multiset{{1, 2, 3},
+                   0, std::hash<int>{}, {}}),
              std::unordered_multiset<int>>);
 
 static_assert(std::is_same_v<
              decltype(std::unordered_multiset{{1, 2, 3},
-                   0, std::hash<int>{}, {}}),
+                   {}}),
              std::unordered_multiset<int>>);
 
 static_assert(std::is_same_v<
              decltype(std::unordered_multiset{{1, 2, 3},
-                   {}}),
+                   1}),
+             std::unordered_multiset<int>>);
+
+static_assert(std::is_same_v<
+             decltype(std::unordered_multiset{{1, 2, 3},
+                   1, std::allocator<int>{}}),
              std::unordered_multiset<int>>);
 
+static_assert(std::is_same_v<
+             decltype(std::unordered_multiset{{1, 2, 3},
+                   1, SimpleAllocator<int>{}}),
+             std::unordered_multiset<int, std::hash<int>,
+             std::equal_to<int>,
+             SimpleAllocator<int>>>);
+
+static_assert(std::is_same_v<
+             decltype(std::unordered_multiset{{1, 2, 3},
+                   1, std::hash<int>{}, std::allocator<int>{}}),
+             std::unordered_multiset<int>>);
+
+static_assert(std::is_same_v<
+             decltype(std::unordered_multiset{{1, 2, 3},
+                   1, std::hash<int>{}, SimpleAllocator<int>{}}),
+             std::unordered_multiset<int, std::hash<int>,
+             std::equal_to<int>,
+             SimpleAllocator<int>>>);
+
 static_assert(std::is_same_v<
              decltype(std::unordered_multiset{{1, 2, 3},
                    {}, {}, {}, std::allocator<int>{}}),
@@ -59,9 +84,41 @@ void f()
 
   static_assert(std::is_same_v<
                decltype(std::unordered_multiset(x.begin(), x.end(),
-                                 {})),
+                     {})),
                std::unordered_multiset<int>>);
 
+  static_assert(std::is_same_v<
+               decltype(std::unordered_multiset{x.begin(), x.end(), 1}),
+               std::unordered_multiset<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_multiset{x.begin(), x.end(),
+                     1,
+                     std::allocator<int>{}}),
+               std::unordered_multiset<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_multiset{x.begin(), x.end(),
+                     1,
+                     SimpleAllocator<int>{}}),
+               std::unordered_multiset<int, std::hash<int>,
+               std::equal_to<int>,
+               SimpleAllocator<int>>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_multiset{x.begin(), x.end(),
+                     1, std::hash<int>{},
+                     std::allocator<int>{}}),
+               std::unordered_multiset<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_multiset{x.begin(), x.end(),
+                     1, std::hash<int>{},
+                     SimpleAllocator<int>{}}),
+               std::unordered_multiset<int, std::hash<int>,
+               std::equal_to<int>,
+               SimpleAllocator<int>>>);
+
   static_assert(std::is_same_v<
                decltype(std::unordered_multiset{x.begin(), x.end(),
                      {}, {}, {},
index c7e1798ef7de65eb8085945f80e100b0ba1b661a..61f21d2b1f42f0e17e78603afb8b1e4f3e3af99d 100644 (file)
@@ -11,19 +11,39 @@ static_assert(std::is_same_v<
              std::unordered_set<int>>);
 
 static_assert(std::is_same_v<
-             decltype(std::unordered_set{1, 2, 3}),
+             decltype(std::unordered_set{{1, 2, 3},
+                   0, std::hash<int>{}, {}}),
              std::unordered_set<int>>);
 
 static_assert(std::is_same_v<
              decltype(std::unordered_set{{1, 2, 3},
-                   0, std::hash<int>{}, {}}),
+                   {}}),
              std::unordered_set<int>>);
 
 static_assert(std::is_same_v<
              decltype(std::unordered_set{{1, 2, 3},
-                   {}}),
+                   1, std::allocator<int>{}}),
              std::unordered_set<int>>);
 
+static_assert(std::is_same_v<
+             decltype(std::unordered_set{{1, 2, 3},
+                   1, SimpleAllocator<int>{}}),
+             std::unordered_set<int, std::hash<int>,
+             std::equal_to<int>,
+             SimpleAllocator<int>>>);
+
+static_assert(std::is_same_v<
+             decltype(std::unordered_set{{1, 2, 3},
+                   1, std::hash<int>{}, std::allocator<int>{}}),
+             std::unordered_set<int>>);
+
+static_assert(std::is_same_v<
+             decltype(std::unordered_set{{1, 2, 3},
+                   1, std::hash<int>{}, SimpleAllocator<int>{}}),
+             std::unordered_set<int, std::hash<int>,
+             std::equal_to<int>,
+             SimpleAllocator<int>>>);
+
 static_assert(std::is_same_v<
              decltype(std::unordered_set{{1, 2, 3},
                    {}, {}, {}, std::allocator<int>{}}),
@@ -59,9 +79,41 @@ void f()
 
   static_assert(std::is_same_v<
                decltype(std::unordered_set(x.begin(), x.end(),
-                                 {})),
+                     {})),
+               std::unordered_set<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_set{x.begin(), x.end(), 1}),
                std::unordered_set<int>>);
 
+  static_assert(std::is_same_v<
+               decltype(std::unordered_set{x.begin(), x.end(),
+                     1,
+                     std::allocator<int>{}}),
+               std::unordered_set<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_set{x.begin(), x.end(),
+                     1,
+                     SimpleAllocator<int>{}}),
+               std::unordered_set<int, std::hash<int>,
+               std::equal_to<int>,
+               SimpleAllocator<int>>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_set{x.begin(), x.end(),
+                     1, std::hash<int>{},
+                     std::allocator<int>{}}),
+               std::unordered_set<int>>);
+
+  static_assert(std::is_same_v<
+               decltype(std::unordered_set{x.begin(), x.end(),
+                     1, std::hash<int>{},
+                     SimpleAllocator<int>{}}),
+               std::unordered_set<int, std::hash<int>,
+               std::equal_to<int>,
+               SimpleAllocator<int>>>);
+
   static_assert(std::is_same_v<
                decltype(std::unordered_set{x.begin(), x.end(),
                      {}, {}, {},