STL_MSFT updated this revision to Diff 135352.
STL_MSFT added a comment.

Update based on code review feedback.


https://reviews.llvm.org/D43273

Files:
  test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
  test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp
  test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
  test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
  test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
  
test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
  
test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
  
test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
  
test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp

Index: test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
===================================================================
--- test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
+++ test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
@@ -16,6 +16,7 @@
 
 #include <tuple>
 #include <string>
+#include <cassert>
 #include "test_macros.h"
 
 #if TEST_HAS_BUILTIN_IDENTIFIER(__reference_binds_to_temporary)
Index: test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
===================================================================
--- test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
+++ test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
@@ -52,7 +52,7 @@
     {
 // https://bugs.llvm.org/show_bug.cgi?id=31454
     std::basic_string<veryLarge> s;
-    veryLarge vl;
+    veryLarge vl = {};
     s.push_back(vl);
     s.push_back(vl);
     s.push_back(vl);
Index: test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
===================================================================
--- test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
+++ test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
@@ -87,50 +87,50 @@
         }
 }
 
-int triangle(int n) { return n*(n+1)/2; }
+size_t triangle(size_t n) { return n*(n+1)/2; }
 
 //  Basic sanity
 void basic_tests()
 {
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::fill(v.begin(), v.end(), 3);
-    std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 50);
+    std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, size_t{50});
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == 50 + (int) (i + 1) * 4);
+        assert(v[i] == 50 + (i + 1) * 4);
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 0);
-    std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 30);
+    std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, size_t{30});
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == 30 + triangle(i) + (int) (i + 1));
+        assert(v[i] == 30 + triangle(i) + i + 1);
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 1);
-    std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 40);
+    std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, size_t{40});
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == 40 + triangle(i + 1) + (int) (i + 1));
+        assert(v[i] == 40 + triangle(i + 1) + i + 1);
     }
 
     {
-    std::vector<int> v, res;
-    std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), add_one{}, 1);
+    std::vector<size_t> v, res;
+    std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), add_one{}, size_t{1});
     assert(res.empty());
     }
 
 //  Make sure that the calculations are done using the init typedef
     {
     std::vector<unsigned char> v(10);
     std::iota(v.begin(), v.end(), static_cast<unsigned char>(1));
-    std::vector<int> res;
-    std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), add_one{}, 1);
+    std::vector<size_t> res;
+    std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), add_one{}, size_t{1});
 
     assert(res.size() == 10);
-    int j = 2;
+    size_t j = 2;
     assert(res[0] == 2);
     for (size_t i = 1; i < res.size(); ++i)
     {
Index: test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
===================================================================
--- test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
+++ test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
@@ -76,39 +76,39 @@
         }
 }
 
-int triangle(int n) { return n*(n+1)/2; }
+size_t triangle(size_t n) { return n*(n+1)/2; }
 
 //  Basic sanity
 void basic_tests()
 {
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::fill(v.begin(), v.end(), 3);
     std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{});
-    std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));
+    std::copy(v.begin(), v.end(), std::ostream_iterator<size_t>(std::cout, " "));
     std::cout << std::endl;
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == (int)(i+1) * 4);
+        assert(v[i] == (i+1) * 4);
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 0);
     std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{});
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == triangle(i) + (int)(i + 1));
+        assert(v[i] == triangle(i) + i + 1);
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 1);
     std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{});
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == triangle(i + 1) + (int)(i + 1));
+        assert(v[i] == triangle(i + 1) + i + 1);
     }
 
     {
-    std::vector<int> v, res;
+    std::vector<size_t> v, res;
     std::transform_inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), add_one{});
     assert(res.empty());
     }
Index: test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
===================================================================
--- test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
+++ test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
@@ -87,50 +87,50 @@
         }
 }
 
-int triangle(int n) { return n*(n+1)/2; }
+size_t triangle(size_t n) { return n*(n+1)/2; }
 
 //  Basic sanity
 void basic_tests()
 {
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::fill(v.begin(), v.end(), 3);
-    std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 50, std::plus<>(), add_one{});
+    std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), size_t{50}, std::plus<>(), add_one{});
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == 50 + (int) i * 4);
+        assert(v[i] == 50 + i * 4);
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 0);
-    std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 30, std::plus<>(), add_one{});
+    std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), size_t{30}, std::plus<>(), add_one{});
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == 30 + triangle(i - 1) + (int) i);
+        assert(v[i] == 30 + triangle(i - 1) + i);
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 1);
-    std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 40, std::plus<>(), add_one{});
+    std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), size_t{40}, std::plus<>(), add_one{});
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == 40 + triangle(i) + (int) i);
+        assert(v[i] == 40 + triangle(i) + i);
     }
 
     {
-    std::vector<int> v, res;
-    std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 40, std::plus<>(), add_one{});
+    std::vector<size_t> v, res;
+    std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), size_t{40}, std::plus<>(), add_one{});
     assert(res.empty());
     }
 
 //  Make sure that the calculations are done using the init typedef
     {
     std::vector<unsigned char> v(10);
     std::iota(v.begin(), v.end(), static_cast<unsigned char>(1));
-    std::vector<int> res;
-    std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 1, std::multiplies<>(), add_one{});
+    std::vector<size_t> res;
+    std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), size_t{1}, std::multiplies<>(), add_one{});
 
     assert(res.size() == 10);
-    int j = 1;
+    size_t j = 1;
     assert(res[0] == 1);
     for (size_t i = 1; i < res.size(); ++i)
     {
Index: test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
===================================================================
--- test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
+++ test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
@@ -60,50 +60,50 @@
         }
 }
 
-int triangle(int n) { return n*(n+1)/2; }
+size_t triangle(size_t n) { return n*(n+1)/2; }
 
 //  Basic sanity
 void basic_tests()
 {
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::fill(v.begin(), v.end(), 3);
-    std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 50);
+    std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), size_t{50});
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == 50 + (int)(i+1) * 3);
+        assert(v[i] == 50 + (i+1) * 3);
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 0);
-    std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 40);
+    std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), size_t{40});
     for (size_t i = 0; i < v.size(); ++i)
         assert(v[i] == 40 + triangle(i));
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 1);
-    std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 30);
+    std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), size_t{30});
     for (size_t i = 0; i < v.size(); ++i)
         assert(v[i] == 30 + triangle(i + 1));
     }
 
     {
-    std::vector<int> v, res;
-    std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), 40);
+    std::vector<size_t> v, res;
+    std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>(), size_t{40});
     assert(res.empty());
     }
 
 //  Make sure that the calculations are done using the init typedef
     {
     std::vector<unsigned char> v(10);
     std::iota(v.begin(), v.end(), static_cast<unsigned char>(1));
-    std::vector<int> res;
-    std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), 1);
+    std::vector<size_t> res;
+    std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::multiplies<>(), size_t{1});
 
     assert(res.size() == 10);
-    int j = 1;
+    size_t j = 1;
     assert(res[0] == 1);
     for (size_t i = 1; i < v.size(); ++i)
     {
Index: test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
===================================================================
--- test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
+++ test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
@@ -61,37 +61,37 @@
         }
 }
 
-int triangle(int n) { return n*(n+1)/2; }
+size_t triangle(size_t n) { return n*(n+1)/2; }
 
 //  Basic sanity
 void basic_tests()
 {
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::fill(v.begin(), v.end(), 3);
     std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>());
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == (int)(i+1) * 3);
+        assert(v[i] == (i+1) * 3);
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 0);
     std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>());
     for (size_t i = 0; i < v.size(); ++i)
         assert(v[i] == triangle(i));
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 1);
     std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>());
     for (size_t i = 0; i < v.size(); ++i)
         assert(v[i] == triangle(i + 1));
     }
 
     {
-    std::vector<int> v, res;
+    std::vector<size_t> v, res;
     std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res), std::plus<>());
     assert(res.empty());
     }
Index: test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
===================================================================
--- test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
+++ test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
@@ -55,37 +55,37 @@
         test(Iter(ia), Iter(ia + i), pRes, pRes + i);
 }
 
-int triangle(int n) { return n*(n+1)/2; }
+size_t triangle(size_t n) { return n*(n+1)/2; }
 
 //  Basic sanity
 void basic_tests()
 {
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::fill(v.begin(), v.end(), 3);
     std::inclusive_scan(v.begin(), v.end(), v.begin());
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == (int)(i+1) * 3);
+        assert(v[i] == (i+1) * 3);
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 0);
     std::inclusive_scan(v.begin(), v.end(), v.begin());
     for (size_t i = 0; i < v.size(); ++i)
         assert(v[i] == triangle(i));
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 1);
     std::inclusive_scan(v.begin(), v.end(), v.begin());
     for (size_t i = 0; i < v.size(); ++i)
         assert(v[i] == triangle(i + 1));
     }
 
     {
-    std::vector<int> v, res;
+    std::vector<size_t> v, res;
     std::inclusive_scan(v.begin(), v.end(), std::back_inserter(res));
     assert(res.empty());
     }
Index: test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp
===================================================================
--- test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp
+++ test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp
@@ -74,11 +74,11 @@
     {
     std::vector<unsigned char> v(10);
     std::iota(v.begin(), v.end(), static_cast<unsigned char>(1));
-    std::vector<int> res;
+    std::vector<size_t> res;
     std::exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 1, std::multiplies<>());
 
     assert(res.size() == 10);
-    int j = 1;
+    size_t j = 1;
     assert(res[0] == 1);
     for (size_t i = 1; i < v.size(); ++i)
     {
Index: test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
===================================================================
--- test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
+++ test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
@@ -55,31 +55,31 @@
         test(Iter(ia), Iter(ia + i), 0, pRes, pRes + i);
 }
 
-int triangle(int n) { return n*(n+1)/2; }
+size_t triangle(size_t n) { return n*(n+1)/2; }
 
 //  Basic sanity
 void basic_tests()
 {
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::fill(v.begin(), v.end(), 3);
-    std::exclusive_scan(v.begin(), v.end(), v.begin(), 50);
+    std::exclusive_scan(v.begin(), v.end(), v.begin(), size_t{50});
     for (size_t i = 0; i < v.size(); ++i)
-        assert(v[i] == 50 + (int) i * 3);
+        assert(v[i] == 50 + i * 3);
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 0);
-    std::exclusive_scan(v.begin(), v.end(), v.begin(), 30);
+    std::exclusive_scan(v.begin(), v.end(), v.begin(), size_t{30});
     for (size_t i = 0; i < v.size(); ++i)
         assert(v[i] == 30 + triangle(i-1));
     }
 
     {
-    std::vector<int> v(10);
+    std::vector<size_t> v(10);
     std::iota(v.begin(), v.end(), 1);
-    std::exclusive_scan(v.begin(), v.end(), v.begin(), 40);
+    std::exclusive_scan(v.begin(), v.end(), v.begin(), size_t{40});
     for (size_t i = 0; i < v.size(); ++i)
         assert(v[i] == 40 + triangle(i));
     }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to