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

Changed data members to size_t as requested (also changed parameters for 
consistency).


https://reviews.llvm.org/D27268

Files:
  
test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp
  test/support/archetypes.hpp
  test/support/count_new.hpp

Index: test/support/count_new.hpp
===================================================================
--- test/support/count_new.hpp
+++ test/support/count_new.hpp
@@ -59,12 +59,12 @@
     int outstanding_new;
     int new_called;
     int delete_called;
-    int last_new_size;
+    std::size_t last_new_size;
 
     int outstanding_array_new;
     int new_array_called;
     int delete_array_called;
-    int last_new_array_size;
+    std::size_t last_new_array_size;
 
 public:
     void newCalled(std::size_t s)
@@ -174,12 +174,12 @@
         return disable_checking || n != delete_called;
     }
 
-    bool checkLastNewSizeEq(int n) const
+    bool checkLastNewSizeEq(std::size_t n) const
     {
         return disable_checking || n == last_new_size;
     }
 
-    bool checkLastNewSizeNotEq(int n) const
+    bool checkLastNewSizeNotEq(std::size_t n) const
     {
         return disable_checking || n != last_new_size;
     }
@@ -214,12 +214,12 @@
         return disable_checking || n != delete_array_called;
     }
 
-    bool checkLastNewArraySizeEq(int n) const
+    bool checkLastNewArraySizeEq(std::size_t n) const
     {
         return disable_checking || n == last_new_array_size;
     }
 
-    bool checkLastNewArraySizeNotEq(int n) const
+    bool checkLastNewArraySizeNotEq(std::size_t n) const
     {
         return disable_checking || n != last_new_array_size;
     }
@@ -304,10 +304,10 @@
     void requireExactly(std::size_t N) { m_req_alloc = N; m_exactly = true; }
 
     ~RequireAllocationGuard() {
-        assert(globalMemCounter.checkOutstandingNewEq(m_outstanding_new_on_init));
+        assert(globalMemCounter.checkOutstandingNewEq(static_cast<int>(m_outstanding_new_on_init)));
         std::size_t Expect = m_new_count_on_init + m_req_alloc;
-        assert(globalMemCounter.checkNewCalledEq(Expect) ||
-               (!m_exactly && globalMemCounter.checkNewCalledGreaterThan(Expect)));
+        assert(globalMemCounter.checkNewCalledEq(static_cast<int>(Expect)) ||
+               (!m_exactly && globalMemCounter.checkNewCalledGreaterThan(static_cast<int>(Expect))));
     }
 
 private:
Index: test/support/archetypes.hpp
===================================================================
--- test/support/archetypes.hpp
+++ test/support/archetypes.hpp
@@ -69,11 +69,11 @@
     }
     template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
     explicit TestBase(std::initializer_list<int>& il, int = 0) noexcept
-      : value(il.size()) {
+      : value(static_cast<int>(il.size())) {
         ++alive; ++constructed; ++value_constructed;
     }
     template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
-    explicit TestBase(std::initializer_list<int>& il, int = 0) noexcept : value(il.size()) {
+    explicit TestBase(std::initializer_list<int>& il, int = 0) noexcept : value(static_cast<int>(il.size())) {
         ++alive; ++constructed; ++value_constructed;
     }
     TestBase& operator=(int xvalue) noexcept {
@@ -135,9 +135,9 @@
     template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
     constexpr ValueBase(int, int y) : value(y) {}
     template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
-    explicit constexpr ValueBase(std::initializer_list<int>& il, int = 0) : value(il.size()) {}
+    explicit constexpr ValueBase(std::initializer_list<int>& il, int = 0) : value(static_cast<int>(il.size())) {}
     template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
-    constexpr ValueBase(std::initializer_list<int>& il, int = 0) : value(il.size()) {}
+    constexpr ValueBase(std::initializer_list<int>& il, int = 0) : value(static_cast<int>(il.size())) {}
     TEST_CONSTEXPR_CXX14 ValueBase& operator=(int xvalue) noexcept {
         value = xvalue;
         return *this;
@@ -193,9 +193,9 @@
     template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
     constexpr TrivialValueBase(int, int y) : value(y) {}
     template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
-    explicit constexpr TrivialValueBase(std::initializer_list<int>& il, int = 0) : value(il.size()) {}
+    explicit constexpr TrivialValueBase(std::initializer_list<int>& il, int = 0) : value(static_cast<int>(il.size())) {}
     template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
-    constexpr TrivialValueBase(std::initializer_list<int>& il, int = 0) : value(il.size()) {};
+    constexpr TrivialValueBase(std::initializer_list<int>& il, int = 0) : value(static_cast<int>(il.size())) {}
     int value;
 protected:
     constexpr TrivialValueBase() noexcept : value(0) {}
Index: test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp
===================================================================
--- test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp
+++ test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp
@@ -23,9 +23,9 @@
 struct TestT {
   int x;
   int size;
-  constexpr TestT(std::initializer_list<int> il) : x(*il.begin()), size(il.size()) {}
+  constexpr TestT(std::initializer_list<int> il) : x(*il.begin()), size(static_cast<int>(il.size())) {}
   constexpr TestT(std::initializer_list<int> il, const int*)
-      : x(*il.begin()), size(il.size()) {}
+      : x(*il.begin()), size(static_cast<int>(il.size())) {}
 };
 
 int main()
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to