Fix tests that use allocators with incorrect value types
authorJonathan Wakely <jwakely@redhat.com>
Fri, 19 Oct 2018 21:49:40 +0000 (22:49 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 19 Oct 2018 21:49:40 +0000 (22:49 +0100)
As a GNU extension we allow containers to be instantiated with
allocators that use a different value type from the container, and
automatically rebind the allocator to the correct type. This extension
is disabled in strict modes (when __STRICT_ANSI__ is defined, i.e.
-std=c++NN dialects). These testcases unintentionally rely on the
extension and so fail for strict modes.

Tests which intentionally make use of the extension will still fail in
strict dialects, but will be addressed in a later change.

* testsuite/20_util/scoped_allocator/1.cc: Use allocator with correct
value type for the container.
* testsuite/23_containers/forward_list/cons/14.cc: Likewise.
* testsuite/23_containers/map/56613.cc: Likewise.
* testsuite/23_containers/unordered_map/55043.cc: Likewise.
* testsuite/23_containers/unordered_map/allocator/copy.cc: Likewise.
* testsuite/23_containers/unordered_map/allocator/copy_assign.cc:
Likewise.
* testsuite/23_containers/unordered_map/allocator/minimal.cc:
Likewise.
* testsuite/23_containers/unordered_map/allocator/move.cc: Likewise.
* testsuite/23_containers/unordered_map/allocator/move_assign.cc:
Likewise.
* testsuite/23_containers/unordered_map/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_map/cons/81891.cc: Likewise.
* testsuite/23_containers/unordered_map/requirements/exception/
basic.cc: Likewise.
* testsuite/23_containers/unordered_map/requirements/exception/
generation_prohibited.cc: Likewise.
* testsuite/23_containers/unordered_map/requirements/exception/
propagation_consistent.cc: Likewise.
* testsuite/23_containers/unordered_multimap/55043.cc: Likewise.
* testsuite/23_containers/unordered_multimap/allocator/copy.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/allocator/minimal.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/allocator/move.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/allocator/move_assign.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/requirements/exception/
basic.cc: Likewise.
* testsuite/23_containers/unordered_multimap/requirements/exception/
generation_prohibited.cc: Likewise.
* testsuite/23_containers/unordered_multimap/requirements/exception/
propagation_consistent.cc: Likewise.
* testsuite/23_containers/unordered_multimap/requirements/
explicit_instantiation/5.cc: Likewise.
* testsuite/ext/malloc_allocator/sanity.cc: Likewise.

From-SVN: r265331

27 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/20_util/scoped_allocator/1.cc
libstdc++-v3/testsuite/23_containers/forward_list/cons/14.cc
libstdc++-v3/testsuite/23_containers/map/56613.cc
libstdc++-v3/testsuite/23_containers/unordered_map/55043.cc
libstdc++-v3/testsuite/23_containers/unordered_map/allocator/copy.cc
libstdc++-v3/testsuite/23_containers/unordered_map/allocator/copy_assign.cc
libstdc++-v3/testsuite/23_containers/unordered_map/allocator/minimal.cc
libstdc++-v3/testsuite/23_containers/unordered_map/allocator/move.cc
libstdc++-v3/testsuite/23_containers/unordered_map/allocator/move_assign.cc
libstdc++-v3/testsuite/23_containers/unordered_map/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/unordered_map/cons/81891.cc
libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/basic.cc
libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/generation_prohibited.cc
libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/propagation_consistent.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/55043.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/copy.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/minimal.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/move.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/move_assign.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/noexcept.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/basic.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/generation_prohibited.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/exception/propagation_consistent.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/5.cc
libstdc++-v3/testsuite/ext/malloc_allocator/sanity.cc

index a3a961161bc2d425adc15de5a0b0c0ab10f54cc8..c7cdc0055023f41d13e990492f859e23abbd6722 100644 (file)
@@ -1,5 +1,50 @@
 2018-10-19  Jonathan Wakely  <jwakely@redhat.com>
 
+       * testsuite/20_util/scoped_allocator/1.cc: Use allocator with correct
+       value type for the container.
+       * testsuite/23_containers/forward_list/cons/14.cc: Likewise.
+       * testsuite/23_containers/map/56613.cc: Likewise.
+       * testsuite/23_containers/unordered_map/55043.cc: Likewise.
+       * testsuite/23_containers/unordered_map/allocator/copy.cc: Likewise.
+       * testsuite/23_containers/unordered_map/allocator/copy_assign.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_map/allocator/minimal.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_map/allocator/move.cc: Likewise.
+       * testsuite/23_containers/unordered_map/allocator/move_assign.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_map/allocator/noexcept.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_map/cons/81891.cc: Likewise.
+       * testsuite/23_containers/unordered_map/requirements/exception/
+       basic.cc: Likewise.
+       * testsuite/23_containers/unordered_map/requirements/exception/
+       generation_prohibited.cc: Likewise.
+       * testsuite/23_containers/unordered_map/requirements/exception/
+       propagation_consistent.cc: Likewise.
+       * testsuite/23_containers/unordered_multimap/55043.cc: Likewise.
+       * testsuite/23_containers/unordered_multimap/allocator/copy.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_multimap/allocator/minimal.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_multimap/allocator/move.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
+       Likewise.
+       * testsuite/23_containers/unordered_multimap/requirements/exception/
+       basic.cc: Likewise.
+       * testsuite/23_containers/unordered_multimap/requirements/exception/
+       generation_prohibited.cc: Likewise.
+       * testsuite/23_containers/unordered_multimap/requirements/exception/
+       propagation_consistent.cc: Likewise.
+       * testsuite/23_containers/unordered_multimap/requirements/
+       explicit_instantiation/5.cc: Likewise.
+       * testsuite/ext/malloc_allocator/sanity.cc: Likewise.
+
        * ext/special_functions/airy_ai/check_nan.cc: Skip test for
        non-standard extension when a strict -std=c++NN dialect is used.
        * ext/special_functions/airy_ai/check_value.cc: Likewise.
index 3a1eb2cfad73a24ab4525376b1fe844546b285f7..b546b495d9583a8a02db6da08900651599516d17 100644 (file)
@@ -57,12 +57,14 @@ void test01()
 
 void test02()
 {
-  typedef std::scoped_allocator_adaptor<Element::allocator_type> inner_alloc_type;
+  typedef std::scoped_allocator_adaptor<Element::allocator_type> alloc1_type;
 
-  typedef std::vector<Element, inner_alloc_type> EltVec;
+  typedef std::vector<Element, alloc1_type> EltVec;
 
   typedef std::scoped_allocator_adaptor<Element::allocator_type,
-                                        Element::allocator_type> alloc_type;
+                                        Element::allocator_type> alloc2_type;
+
+  typedef std::allocator_traits<alloc2_type>::rebind_alloc<EltVec> alloc_type;
 
   typedef std::vector<EltVec, alloc_type> EltVecVec;
 
@@ -88,10 +90,8 @@ void test02()
   VERIFY( evv3.get_allocator().get_personality() == 3 );
   VERIFY( evv3[0].get_allocator().get_personality() == 4 );
   VERIFY( evv3[0][0].get_allocator().get_personality() == 4 );
-
 }
 
-
 int main()
 {
   test01();
index a27201e2f492aa64c5b471c3dd9d342e07176d0b..9ee497b2e1fa67d378d7f71c90890e14fa0df077 100644 (file)
@@ -26,9 +26,9 @@ void test01()
 {
   using namespace std;
   using list = forward_list<int>;
-  forward_list<list, scoped_allocator_adaptor<list::allocator_type>> l;
+  using alloc_type = allocator<list>;
+  forward_list<list, scoped_allocator_adaptor<alloc_type>> l;
 
   // Check for forward_list(size_type, const allocator_type&)
   l.emplace_front(1u);
 }
-
index 65aebe56d510cdb7fef23506f93a4f25fd151163..e639b81a730e8c47a7a6be98f4606c21ce41007e 100644 (file)
@@ -67,6 +67,6 @@ bool operator!=(alloc<T>, alloc<U>) { return false; }
 
 int main()
 {
-  std::map<int, int, std::less<int>, alloc<int> > m;
+  std::map<int, int, std::less<int>, alloc<std::pair<const int, int>>> m;
   m[1];
 }
index 1f6c55608ad557235ee711d85c2247cd2eba53ad..a4c7c3bb3c575c063394277f968c870ca7e6dd17 100644 (file)
@@ -28,15 +28,9 @@ struct MoveOnly
   MoveOnly(MoveOnly&&) = default;
 };
 
-using hash = std::hash<int>;
-using equal = std::equal_to<int>;
-
-template<typename Alloc>
-  using test_type = std::unordered_map<int, MoveOnly, hash, equal, Alloc>;
-
 void test01()
 {
-  typedef test_type<std::allocator<MoveOnly>> uim;
+  typedef std::unordered_map<int, MoveOnly> uim;
   std::vector<uim> v;
   v.emplace_back(uim());
 }
index 4efc67a193a4851a41eca28c6b1b86efe79d95af..6e2bcef6674afe86b74102a837f6193d5df880c3 100644 (file)
@@ -39,7 +39,7 @@ using __gnu_test::propagating_allocator;
 
 void test01()
 {
-  typedef propagating_allocator<T, false> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, false> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
@@ -51,7 +51,7 @@ void test01()
 
 void test02()
 {
-  typedef propagating_allocator<T, true> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, true> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
@@ -63,7 +63,7 @@ void test02()
 
 void test03()
 {
-  typedef propagating_allocator<T, true> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, true> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
index f6eec6731c1e8ec0b8267d6bd2f06383beeef20e..6393bf56d2b6ea707f71b5245728f7e27f9e10b5 100644 (file)
@@ -39,7 +39,7 @@ using __gnu_test::propagating_allocator;
 
 void test01()
 {
-  typedef propagating_allocator<T, false> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, false> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
@@ -54,7 +54,7 @@ void test01()
 
 void test02()
 {
-  typedef propagating_allocator<T, true> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, true> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
index 23efffa8bf09dc5640dc18f8e91857e28fede95b..4fc096765e22d239c358c0c1bba52cb472546c85 100644 (file)
@@ -40,13 +40,12 @@ struct equal_to
 bool operator==(const T& l, const T& r) { return l.i == r.i; }
 bool operator<(const T& l, const T& r) { return l.i < r.i; }
 
-using __gnu_test::SimpleAllocator;
+typedef __gnu_test::SimpleAllocator<std::pair<const T, T>> alloc_type;
 
-template class std::unordered_map<T, T, hash, equal_to, SimpleAllocator<T>>;
+template class std::unordered_map<T, T, hash, equal_to, alloc_type>;
 
 void test01()
 {
-  typedef SimpleAllocator<T> alloc_type;
   typedef std::allocator_traits<alloc_type> traits_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v(alloc_type{});
index dc33587666bfc28cc3f39def6b762d00ef6c50c0..c79dbeb80c94c47cd574057e5711322638386236 100644 (file)
@@ -39,7 +39,7 @@ using __gnu_test::uneq_allocator;
 
 void test01()
 {
-  typedef uneq_allocator<T> alloc_type;
+  typedef uneq_allocator<std::pair<const T, T>> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
@@ -53,7 +53,7 @@ void test01()
 
 void test02()
 {
-  typedef uneq_allocator<T> alloc_type;
+  typedef uneq_allocator<std::pair<const T, T>> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
index 173287e4df05d577e52c4b1c4671b19abb302d09..b27269e607a2e16244658fbec5836c0a625629d7 100644 (file)
@@ -27,7 +27,8 @@ using __gnu_test::counter_type;
 
 void test01()
 {
-  typedef propagating_allocator<counter_type, false> alloc_type;
+  typedef std::pair<const counter_type, counter_type> value_type;
+  typedef propagating_allocator<value_type, false> alloc_type;
   typedef __gnu_test::counter_type_hasher hash;
   typedef std::unordered_map<counter_type, counter_type, hash,
                             std::equal_to<counter_type>,
@@ -54,7 +55,8 @@ void test01()
 
 void test02()
 {
-  typedef propagating_allocator<counter_type, true> alloc_type;
+  typedef std::pair<const counter_type, counter_type> value_type;
+  typedef propagating_allocator<value_type, true> alloc_type;
   typedef __gnu_test::counter_type_hasher hash;
   typedef std::unordered_map<counter_type, counter_type, hash,
                             std::equal_to<counter_type>,
index f9fd434dfd7a2c9858600a6fd6a26cc64ce9886d..29fbc7bcd8d866bd72a303b495abfc6f0e20d02b 100644 (file)
@@ -44,7 +44,7 @@ using __gnu_test::propagating_allocator;
 
 void test01()
 {
-  typedef std::allocator<T> alloc_type;
+  typedef std::allocator<std::pair<const T, T>> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1;
   test_type v2;
@@ -55,7 +55,7 @@ void test01()
 
 void test02()
 {
-  typedef std::allocator<T> alloc_type;
+  typedef std::allocator<std::pair<const T, T>> alloc_type;
   typedef std::unordered_map<T, T, hash_t, equal_to, alloc_type> test_type;
   test_type v1;
   test_type v2;
@@ -65,7 +65,7 @@ void test02()
 
 void test03()
 {
-  typedef std::allocator<T> alloc_type;
+  typedef std::allocator<std::pair<const T, T>> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to_t, alloc_type> test_type;
   test_type v1;
   test_type v2;
@@ -75,7 +75,7 @@ void test03()
 
 void test04()
 {
-  typedef propagating_allocator<T, false> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, false> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   test_type v2(alloc_type(2));
@@ -85,7 +85,7 @@ void test04()
 
 void test05()
 {
-  typedef propagating_allocator<T, true> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, true> alloc_type;
   typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   test_type v2(alloc_type(2));
index e1debbb429d121a8c759be18d86bf590b628cf3d..f0f8b75e7e56bcba97f21e98e92656c41d039f22 100644 (file)
@@ -26,7 +26,7 @@ struct fails_on_copy {
   fails_on_copy(const fails_on_copy&) { throw 0; };
 };
 
-using value_type = std::pair<int, fails_on_copy>;
+using value_type = std::pair<const int, fails_on_copy>;
 
 void
 test01()
index a8f973fd175d41b2bc6b2ed5507be7a075cb9d46..bbc4cded242762e9d8913b41be77c88b3ac15643 100644 (file)
@@ -27,7 +27,8 @@ void
 value()
 {
   typedef __gnu_cxx::throw_value_limit value_type;
-  typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
+  typedef std::pair<const value_type, value_type> pair_type;
+  typedef __gnu_cxx::throw_allocator_limit<pair_type> allocator_type;
   typedef std::hash<value_type> hash_type;
   typedef std::equal_to<value_type> pred_type;
   typedef std::unordered_map<value_type, value_type, hash_type, pred_type, allocator_type> test_type;
index 11e0a3d68886bdf5f4155a322a9e1b60f7fdceb4..e04f326e1c2925fcfc2f0277daf6f6d08d29bad6 100644 (file)
@@ -27,7 +27,8 @@
 int main()
 {
   typedef __gnu_cxx::throw_value_random value_type;
-  typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
+  typedef std::pair<const value_type, value_type> pair_type;
+  typedef __gnu_cxx::throw_allocator_random<pair_type> allocator_type;
   typedef std::hash<value_type> hash_type;
   typedef std::equal_to<value_type> pred_type;
   typedef std::unordered_map<value_type, value_type, hash_type, pred_type, allocator_type> test_type;
index 1980cc8e8400fa479bb5cd4f4c00a627b32361d2..eb5c0f1b88acc95c71dd105702b821be8926f5b3 100644 (file)
@@ -27,7 +27,8 @@
 int main()
 {
   typedef __gnu_cxx::throw_value_limit value_type;
-  typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
+  typedef std::pair<const value_type, value_type> pair_type;
+  typedef __gnu_cxx::throw_allocator_limit<pair_type> allocator_type;
   typedef std::hash<value_type> hash_type;
   typedef std::equal_to<value_type> pred_type;
   typedef std::unordered_map<value_type, value_type, hash_type, pred_type, allocator_type> test_type;
index 6b95a0a667bfda38f4a671c06aff0a3fbd546026..919cea33341dc95e9eb114e173a0a2e6fee4d6bd 100644 (file)
@@ -28,15 +28,9 @@ struct MoveOnly
   MoveOnly(MoveOnly&&) = default;
 };
 
-using hash = std::hash<int>;
-using equal = std::equal_to<int>;
-
-template<typename Alloc>
-  using test_type = std::unordered_multimap<int, MoveOnly, hash, equal, Alloc>;
-
 void test01()
 {
-  typedef test_type<std::allocator<MoveOnly>> uim;
+  typedef std::unordered_multimap<int, MoveOnly> uim;
   std::vector<uim> v;
   v.emplace_back(uim());
 }
index 13b99ed8260bae17ff39116b66f11e07007b3dc3..38322316406af59380ea4bf7da41b4709f2e74fd 100644 (file)
@@ -39,7 +39,7 @@ using __gnu_test::propagating_allocator;
 
 void test01()
 {
-  typedef propagating_allocator<T, false> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, false> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
@@ -51,7 +51,7 @@ void test01()
 
 void test02()
 {
-  typedef propagating_allocator<T, true> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, true> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
@@ -63,7 +63,7 @@ void test02()
 
 void test03()
 {
-  typedef propagating_allocator<T, true> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, true> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
index 281f7eafc1cde80010060d3ac230536addba437d..15059be652765e42d9eb5db141b3e3b4783acdf7 100644 (file)
@@ -39,7 +39,7 @@ using __gnu_test::propagating_allocator;
 
 void test01()
 {
-  typedef propagating_allocator<T, false> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, false> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
@@ -54,7 +54,7 @@ void test01()
 
 void test02()
 {
-  typedef propagating_allocator<T, true> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, true> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
index b563b97f812c9dcd395721ed1f1e02e76d695cb8..8488eba37f1cdc9d01f8dca3626dad5d0b154989 100644 (file)
@@ -43,11 +43,11 @@ bool operator<(const T& l, const T& r) { return l.i < r.i; }
 using __gnu_test::SimpleAllocator;
 
 template class std::unordered_multimap<T, T, hash, equal_to,
-                                      SimpleAllocator<T>>;
+                                      SimpleAllocator<std::pair<const T, T>>>;
 
 void test01()
 {
-  typedef SimpleAllocator<T> alloc_type;
+  typedef SimpleAllocator<std::pair<const T, T>> alloc_type;
   typedef std::allocator_traits<alloc_type> traits_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v(alloc_type{});
index 2ac6d374b42ad90379035d0d0823677d2f22b48f..33e987ac45b4c881c7cfea27fc70054e432fcb28 100644 (file)
@@ -39,7 +39,7 @@ using __gnu_test::uneq_allocator;
 
 void test01()
 {
-  typedef uneq_allocator<T> alloc_type;
+  typedef uneq_allocator<std::pair<const T, T>> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
@@ -53,7 +53,7 @@ void test01()
 
 void test02()
 {
-  typedef uneq_allocator<T> alloc_type;
+  typedef uneq_allocator<std::pair<const T, T>> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   v1.emplace(std::piecewise_construct,
index f64848b015db7d6b0e4511978d1ab7c0bcc149e9..35c4c289f109178a24823d910fa73d57df3c477f 100644 (file)
 using __gnu_test::propagating_allocator;
 using __gnu_test::counter_type;
 
+typedef std::pair<const counter_type, counter_type> value_type;
+
 void test01()
 {
-  typedef propagating_allocator<counter_type, false> alloc_type;
+  typedef propagating_allocator<value_type, false> alloc_type;
   typedef __gnu_test::counter_type_hasher hash;
   typedef std::unordered_multimap<counter_type, counter_type, hash,
                                  std::equal_to<counter_type>,
@@ -54,7 +56,7 @@ void test01()
 
 void test02()
 {
-  typedef propagating_allocator<counter_type, true> alloc_type;
+  typedef propagating_allocator<value_type, true> alloc_type;
   typedef __gnu_test::counter_type_hasher hash;
   typedef std::unordered_multimap<counter_type, counter_type, hash,
                                  std::equal_to<counter_type>,
index b47a76d35359c8a8e40073008205de2114c2f85a..78fc37038c3ea5f5096d6909ea00dc16329a6f62 100644 (file)
@@ -44,7 +44,7 @@ using __gnu_test::propagating_allocator;
 
 void test01()
 {
-  typedef std::allocator<T> alloc_type;
+  typedef std::allocator<std::pair<const T, T>> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1;
   test_type v2;
@@ -55,7 +55,7 @@ void test01()
 
 void test02()
 {
-  typedef std::allocator<T> alloc_type;
+  typedef std::allocator<std::pair<const T, T>> alloc_type;
   typedef std::unordered_multimap<T, T, hash_t, equal_to, alloc_type> test_type;
   test_type v1;
   test_type v2;
@@ -65,7 +65,7 @@ void test02()
 
 void test03()
 {
-  typedef std::allocator<T> alloc_type;
+  typedef std::allocator<std::pair<const T, T>> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to_t, alloc_type>
     test_type;
   test_type v1;
@@ -76,7 +76,7 @@ void test03()
 
 void test04()
 {
-  typedef propagating_allocator<T, false> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, false> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   test_type v2(alloc_type(2));
@@ -86,7 +86,7 @@ void test04()
 
 void test05()
 {
-  typedef propagating_allocator<T, true> alloc_type;
+  typedef propagating_allocator<std::pair<const T, T>, true> alloc_type;
   typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
   test_type v1(alloc_type(1));
   test_type v2(alloc_type(2));
index 895152e04acf84e32a885bc0c086a19f7dc055bb..81dc0bbe8dfd8ec6e15d722845d0ede2857061e2 100644 (file)
@@ -27,7 +27,8 @@ void
 value()
 {
   typedef __gnu_cxx::throw_value_limit value_type;
-  typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
+  typedef std::pair<const value_type, value_type> pair_type;
+  typedef __gnu_cxx::throw_allocator_limit<pair_type> allocator_type;
   typedef std::hash<value_type> hash_type;
   typedef std::equal_to<value_type> pred_type;
   typedef std::unordered_multimap<value_type, value_type, hash_type, pred_type, allocator_type> test_type;
index 92b0ab870dcf03a8d4e811027e09d117c95bbecb..a05d8867dff2acc758ba4cfb8e20195c976c6a65 100644 (file)
@@ -27,7 +27,8 @@
 int main()
 {
   typedef __gnu_cxx::throw_value_random value_type;
-  typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
+  typedef std::pair<const value_type, value_type> pair_type;
+  typedef __gnu_cxx::throw_allocator_random<pair_type> allocator_type;
   typedef std::hash<value_type> hash_type;
   typedef std::equal_to<value_type> pred_type;
   typedef std::unordered_multimap<value_type, value_type, hash_type, pred_type, allocator_type> test_type;
index db5642883321cb37935961a30ef4edd619ce7f13..58312c99146360f9acb6d5f15af5286f1c94bf80 100644 (file)
@@ -27,7 +27,8 @@
 int main()
 {
   typedef __gnu_cxx::throw_value_limit value_type;
-  typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
+  typedef std::pair<const value_type, value_type> pair_type;
+  typedef __gnu_cxx::throw_allocator_random<pair_type> allocator_type;
   typedef std::hash<value_type> hash_type;
   typedef std::equal_to<value_type> pred_type;
   typedef std::unordered_multimap<value_type, value_type, hash_type, pred_type, allocator_type> test_type;
index 4c29a6f049c165504a8a1e8469dc56b97e3a437e..6cdf0f3f3ca7a42bbb46cdd3418a96fe2e43a088 100644 (file)
@@ -1,4 +1,3 @@
-
 // Copyright (C) 2011-2018 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 
 // { dg-do compile { target c++11 } }
 
+using __gnu_test::ExplicitConsAlloc;
+
 // libstdc++/50118
+template class
+  std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>,
+                         ExplicitConsAlloc<std::pair<const int, int>>>;
 template class std::unordered_multimap<int, int, std::hash<int>,
                                       std::equal_to<int>,
-                                      __gnu_test::ExplicitConsAlloc<int>>;
-template class std::unordered_multimap<int, int, std::hash<int>,
-                                      std::equal_to<int>,
-                                      __gnu_test::ExplicitConsAlloc<char>>;
+                                      ExplicitConsAlloc<char>>;
index 30e978a896d8f646692458f20928545a535a46eb..ef9df0379f912e2484759271aca7cea647140a97 100644 (file)
@@ -24,7 +24,7 @@
 int main()
 {
   std::map<int, int, std::less<int>,
-          __gnu_cxx::malloc_allocator<std::pair<int, int> > > allocs;
+          __gnu_cxx::malloc_allocator<std::pair<const int, int> > > allocs;
   allocs[9] = 3;
   std::vector<int, __gnu_cxx::malloc_allocator<int>> vec(10);
   vec[5] = 42;