libstdc++: -D_GLIBCXX_DEBUG fixes in the constrained algos tests
authorPatrick Palka <ppalka@redhat.com>
Thu, 27 Feb 2020 15:35:08 +0000 (10:35 -0500)
committerPatrick Palka <ppalka@redhat.com>
Thu, 27 Feb 2020 17:47:17 +0000 (12:47 -0500)
This fixes the failures in the constrained algos tests when they are run in
debug mode.

libstdc++-v3/ChangeLog:

* testsuite/25_algorithms/copy/constrained.cc: Don't assume that the
base() of a vector<>::iterator is a pointer.
* testsuite/25_algorithms/copy_backward/constrained.cc: Likewise.
* testsuite/25_algorithms/move/constrained.cc: Likewise.
* testsuite/25_algorithms/move_backward/constrained.cc: Likewise.
* testsuite/25_algorithms/inplace_merge/constrained.cc: Use foo.data()
instead of &foo[0].
* testsuite/25_algorithms/partial_sort/constrained.cc: Likewise.
* testsuite/25_algorithms/partial_sort_copy/constrained.cc: Likewise.
* testsuite/25_algorithms/shuffle/constrained.cc: Likewise.
* testsuite/25_algorithms/sort/constrained.cc: Likewise.
* testsuite/25_algorithms/stable_sort/constrained.cc: Likewise.

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/25_algorithms/copy/constrained.cc
libstdc++-v3/testsuite/25_algorithms/copy_backward/constrained.cc
libstdc++-v3/testsuite/25_algorithms/inplace_merge/constrained.cc
libstdc++-v3/testsuite/25_algorithms/move/constrained.cc
libstdc++-v3/testsuite/25_algorithms/move_backward/constrained.cc
libstdc++-v3/testsuite/25_algorithms/partial_sort/constrained.cc
libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/constrained.cc
libstdc++-v3/testsuite/25_algorithms/shuffle/constrained.cc
libstdc++-v3/testsuite/25_algorithms/sort/constrained.cc
libstdc++-v3/testsuite/25_algorithms/stable_sort/constrained.cc

index bd76b541e8f0e1b8b620fc6ff2245c104998306c..b3efeae221a5f6c3d72aa30f626737c8006f6beb 100644 (file)
@@ -1,3 +1,18 @@
+2020-02-27  Patrick Palka  <ppalka@redhat.com>
+
+       * testsuite/25_algorithms/copy/constrained.cc: Don't assume that the
+       base() of a vector<>::iterator is a pointer.
+       * testsuite/25_algorithms/copy_backward/constrained.cc: Likewise.
+       * testsuite/25_algorithms/move/constrained.cc: Likewise.
+       * testsuite/25_algorithms/move_backward/constrained.cc: Likewise.
+       * testsuite/25_algorithms/inplace_merge/constrained.cc: Use foo.data()
+       instead of &foo[0].
+       * testsuite/25_algorithms/partial_sort/constrained.cc: Likewise.
+       * testsuite/25_algorithms/partial_sort_copy/constrained.cc: Likewise.
+       * testsuite/25_algorithms/shuffle/constrained.cc: Likewise.
+       * testsuite/25_algorithms/sort/constrained.cc: Likewise.
+       * testsuite/25_algorithms/stable_sort/constrained.cc: Likewise.
+
 2020-02-27  Jonathan Wakely  <jwakely@redhat.com>
 
        * include/debug/array (operator<=>): Define for C++20.
index 85f7d649608f5c4ac42164a7c7c5100762d161b7..aafe845db3a3f7d73cf9c3101d8815d812acf1b7 100644 (file)
@@ -70,8 +70,8 @@ test01()
       std::vector<int> y(3);
       const int z[3] = { 1, 2, 3 };
       auto [in, out] = ranges::copy(x, ranges::begin(y));
-      VERIFY( in.base() == x.data()+3 );
-      VERIFY( out.base() == y.data()+3 );
+      VERIFY( in == x.begin()+3 );
+      VERIFY( out == y.begin()+3 );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -81,8 +81,8 @@ test01()
       std::vector<int> y(3);
       const int z[3] = { 1, 2, 3 };
       auto [in, out] = ranges::copy(x, ranges::begin(y));
-      VERIFY( in.base() == x.data()+3 );
-      VERIFY( out.base() == y.data()+3 );
+      VERIFY( in == x.begin()+3 );
+      VERIFY( out == y.begin()+3 );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -93,8 +93,8 @@ test01()
       auto [in,out] = ranges::copy(make_reverse_iterator(x.end()),
                                   make_reverse_iterator(x.begin()),
                                   make_reverse_iterator(y.end()));
-      VERIFY( in.base().base() == x.data()+3 );
-      VERIFY( out.base().base() == y.data() );
+      VERIFY( in.base() == x.begin()+3 );
+      VERIFY( out.base() == y.begin() );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -105,8 +105,8 @@ test01()
       auto [in,out] = ranges::copy(make_reverse_iterator(x.end()),
                                   make_reverse_iterator(x.begin()),
                                   make_reverse_iterator(y.end()));
-      VERIFY( in.base().base() == x.data()+3 );
-      VERIFY( out.base().base() == y.data() );
+      VERIFY( in.base() == x.begin()+3 );
+      VERIFY( out.base() == y.begin() );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 }
index 900f78aaa7383d89da6119efc185f2dbe9d84f5f..9df2a2ff593fead417c137ad0b7cda90b0adebeb 100644 (file)
@@ -57,8 +57,8 @@ test01()
       std::vector<int> y(3);
       const int z[3] = { 1, 2, 3 };
       auto [in, out] = ranges::copy_backward(x, ranges::end(y));
-      VERIFY( in.base() == x.data()+3 );
-      VERIFY( out.base() == y.data() );
+      VERIFY( in == x.begin()+3 );
+      VERIFY( out == y.begin() );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -68,8 +68,8 @@ test01()
       std::vector<int> y(3);
       const int z[3] = { 1, 2, 3 };
       auto [in, out] = ranges::copy_backward(x, ranges::end(y));
-      VERIFY( in.base() == x.data()+3 );
-      VERIFY( out.base() == y.data() );
+      VERIFY( in == x.begin()+3 );
+      VERIFY( out == y.begin() );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -80,8 +80,8 @@ test01()
       auto [in,out] = ranges::copy_backward(make_reverse_iterator(x.end()),
                                            make_reverse_iterator(x.begin()),
                                            make_reverse_iterator(y.begin()));
-      VERIFY( in.base().base() == x.data()+3 );
-      VERIFY( out.base().base() == y.data()+3 );
+      VERIFY( in.base() == x.begin()+3 );
+      VERIFY( out.base() == y.begin()+3 );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -92,8 +92,8 @@ test01()
       auto [in,out] = ranges::copy_backward(make_reverse_iterator(x.end()),
                                            make_reverse_iterator(x.begin()),
                                            make_reverse_iterator(y.begin()));
-      VERIFY( in.base().base() == x.data()+3 );
-      VERIFY( out.base().base() == y.data()+3 );
+      VERIFY( in.base() == x.begin()+3 );
+      VERIFY( out.base() == y.begin()+3 );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 }
index 856056865d980cf4184b1387db62b373d59ef7cb..e6e16c85382444e61ecf7f104f566079ce164c1c 100644 (file)
@@ -40,7 +40,7 @@ test01()
        v.insert(v.end(), x, x+j);
        ranges::sort(v);
 
-       test_range<int, bidirectional_iterator_wrapper> rz(&v[0], &v[0]+i+j);
+       test_range<int, bidirectional_iterator_wrapper> rz(v.data(), v.data()+i+j);
        auto result = ranges::inplace_merge(rz, next(ranges::begin(rz), i));
        VERIFY( result == rz.end() );
 
index d205b3572a1ad0411353c3a5073e4bb51663b2eb..f15de54870971f3cd2b566ff78d1f1ed359c4acb 100644 (file)
@@ -99,8 +99,8 @@ test01()
       std::vector<int> y(3);
       const int z[3] = { 1, 2, 3 };
       auto [in, out] = ranges::move(x, ranges::begin(y));
-      VERIFY( in.base() == x.data()+3 );
-      VERIFY( out.base() == y.data()+3 );
+      VERIFY( in == x.begin()+3 );
+      VERIFY( out == y.begin()+3 );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -110,8 +110,8 @@ test01()
       std::vector<int> y(3);
       const int z[3] = { 1, 2, 3 };
       auto [in, out] = ranges::move(x, ranges::begin(y));
-      VERIFY( in.base() == x.data()+3 );
-      VERIFY( out.base() == y.data()+3 );
+      VERIFY( in == x.begin()+3 );
+      VERIFY( out == y.begin()+3 );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -122,8 +122,8 @@ test01()
       auto [in,out] = ranges::move(make_reverse_iterator(x.end()),
                                   make_reverse_iterator(x.begin()),
                                   make_reverse_iterator(y.end()));
-      VERIFY( in.base().base() == x.data()+3 );
-      VERIFY( out.base().base() == y.data() );
+      VERIFY( in.base() == x.begin()+3 );
+      VERIFY( out.base() == y.begin() );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -134,8 +134,8 @@ test01()
       auto [in,out] = ranges::move(make_reverse_iterator(x.end()),
                                   make_reverse_iterator(x.begin()),
                                   make_reverse_iterator(y.end()));
-      VERIFY( in.base().base() == x.data()+3 );
-      VERIFY( out.base().base() == y.data() );
+      VERIFY( in.base() == x.begin()+3 );
+      VERIFY( out.base() == y.begin() );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 }
index 3c4aa5dc70d3c7eea2d321b93d2c845e34db90d2..14f215578c762dd987484223eea434147cbc514a 100644 (file)
@@ -86,8 +86,8 @@ test01()
       std::vector<int> y(3);
       const int z[3] = { 1, 2, 3 };
       auto [in, out] = ranges::move_backward(x, ranges::end(y));
-      VERIFY( in.base() == x.data()+3 );
-      VERIFY( out.base() == y.data() );
+      VERIFY( in == x.begin()+3 );
+      VERIFY( out == y.begin() );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -97,8 +97,8 @@ test01()
       std::vector<int> y(3);
       const int z[3] = { 1, 2, 3 };
       auto [in, out] = ranges::move_backward(x, ranges::end(y));
-      VERIFY( in.base() == x.data()+3 );
-      VERIFY( out.base() == y.data() );
+      VERIFY( in == x.begin()+3 );
+      VERIFY( out == y.begin() );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -109,8 +109,8 @@ test01()
       auto [in,out] = ranges::move_backward(make_reverse_iterator(x.end()),
                                            make_reverse_iterator(x.begin()),
                                            make_reverse_iterator(y.begin()));
-      VERIFY( in.base().base() == x.data()+3 );
-      VERIFY( out.base().base() == y.data()+3 );
+      VERIFY( in.base() == x.begin()+3 );
+      VERIFY( out.base() == y.begin()+3 );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 
@@ -121,8 +121,8 @@ test01()
       auto [in,out] = ranges::move_backward(make_reverse_iterator(x.end()),
                                            make_reverse_iterator(x.begin()),
                                            make_reverse_iterator(y.begin()));
-      VERIFY( in.base().base() == x.data()+3 );
-      VERIFY( out.base().base() == y.data()+3 );
+      VERIFY( in.base() == x.begin()+3 );
+      VERIFY( out.base() == y.begin()+3 );
       VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
     }
 }
index 430e3c0b61bbf40857aa5c746f2f269a9602ad2b..3b61fe73fd7220af33c50c4f30faa29ded591fda 100644 (file)
@@ -40,9 +40,9 @@ test01()
       std::iota(vref.begin(), vref.end(), 0);
       std::vector<int> v1(vref), v2(vref);
       test_container<int, random_access_iterator_wrapper> c
-       = {&v1[0], &v1[0] + size};
+       = {v1.data(), v1.data() + size};
       test_range<int, random_access_iterator_wrapper> r
-       = {&v2[0], &v2[0] + size};
+       = {v2.data(), v2.data() + size};
 
       std::ranlux48_base g1(size), g2(size + 1);
       ranges::shuffle(c, g1);
index 6b586f885dd352aa96c73b04c883e49a367b942a..519c41f2bde4e11c14dae3ede25aa058c66b0763 100644 (file)
@@ -49,15 +49,15 @@ test01()
       for (unsigned middle = 0; middle < 10; ++middle)
        {
          test_container<int, forward_iterator_wrapper> c
-           = {&v1[0], &v1[0] + size};
+           = {v1.data(), v1.data() + size};
          test_range<int, input_iterator_wrapper> r
-           = {&v2[0], &v2[0] + size};
+           = {v2.data(), v2.data() + size};
 
          std::vector<int> o1(middle), o2(middle);
          test_range<int, random_access_iterator_wrapper> w1
-           = {&o1[0], &o1[0]+middle};
+           = {o1.data(), o1.data()+middle};
          test_range<int, random_access_iterator_wrapper> w2
-           = {&o2[0], &o2[0]+middle};
+           = {o2.data(), o2.data()+middle};
 
          auto [in1, out1] = ranges::partial_sort_copy(c.begin(), c.end(),
                                                       w1.begin(), w1.end(),
index b96343aecceac2c28935a599f8dc612b1368e484..3f976005b37df74dee3b85f9238254a2c9e04bad 100644 (file)
@@ -42,9 +42,9 @@ test01()
       std::iota(vref.begin(), vref.end(), 0);
       std::vector<int> v1(vref), v2(vref);
       test_container<int, random_access_iterator_wrapper> c
-       = {&v1[0], &v1[0] + size};
+       = {v1.data(), v1.data() + size};
       test_range<int, random_access_iterator_wrapper> r
-       = {&v2[0], &v2[0] + size};
+       = {v2.data(), v2.data() + size};
 
       std::ranlux48_base g1(size), g2(size + 1);
       VERIFY( ranges::shuffle(c, g1) == c.end() );
index d8227773ccb11ca4d5240ac8b90a80ae0640fdb1..b5a99b73cc3115250aaec361db7b24573d91eaad 100644 (file)
@@ -40,9 +40,9 @@ test01()
       std::iota(vref.begin(), vref.end(), 0);
       std::vector<int> v1(vref), v2(vref);
       test_container<int, random_access_iterator_wrapper> c
-       = {&v1[0], &v1[0] + size};
+       = {v1.data(), v1.data() + size};
       test_range<int, random_access_iterator_wrapper> r
-       = {&v2[0], &v2[0] + size};
+       = {v2.data(), v2.data() + size};
 
       std::ranlux48_base g1(size), g2(size + 1);
       ranges::shuffle(c, g1);
index 23a8c03b519368b34920bef0cfd9ff65a746b95c..ef02ccaae45e7e4fe07b266ec6730c17806b3a9c 100644 (file)
@@ -44,9 +44,9 @@ test01()
       std::iota(vref.begin(), vref.end(), 0);
       std::vector<int> v1(vref), v2(vref);
       test_container<int, random_access_iterator_wrapper> c
-       = {&v1[0], &v1[0] + size};
+       = {v1.data(), v1.data() + size};
       test_range<int, random_access_iterator_wrapper> r
-       = {&v2[0], &v2[0] + size};
+       = {v2.data(), v2.data() + size};
 
       std::ranlux48_base g1(size), g2(size + 1);
       ranges::shuffle(c, g1);