[libc++][test] Silence more warnings in variant tests
authorCasey Carter <Casey@Carter.net>
Mon, 14 Oct 2019 14:38:12 +0000 (14:38 +0000)
committerCasey Carter <Casey@Carter.net>
Mon, 14 Oct 2019 14:38:12 +0000 (14:38 +0000)
More cases of signed-to-unsigned conversion warnings that missed the train for d2623522.

llvm-svn: 374778

libcxx/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
libcxx/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
libcxx/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp
libcxx/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp

index 07ca63f..489dd5d 100644 (file)
@@ -547,7 +547,7 @@ void test_copy_assignment_different_index() {
     struct {
       constexpr Result<int> operator()() const {
         using V = std::variant<int, TCopyAssign, unsigned>;
-        V v(std::in_place_type<unsigned>, 43);
+        V v(std::in_place_type<unsigned>, 43u);
         V v2(std::in_place_type<TCopyAssign>, 42);
         v = v2;
         return {v.index(), std::get<1>(v).value};
index b70f7aa..daa5512 100644 (file)
@@ -407,7 +407,7 @@ void test_move_assignment_different_index() {
   }
   {
     using V = std::variant<int, MoveAssign, unsigned>;
-    V v1(std::in_place_type<unsigned>, 43);
+    V v1(std::in_place_type<unsigned>, 43u);
     V v2(std::in_place_type<MoveAssign>, 42);
     MoveAssign::reset();
     V &vref = (v1 = std::move(v2));
index b09e357..47823b3 100644 (file)
@@ -111,7 +111,7 @@ void test_basic() {
     assert(std::get<2>(v) == &x);
     assert(&ref2 == &std::get<2>(v));
     // emplace with multiple args
-    auto& ref3 = v.emplace<4>(3, 'a');
+    auto& ref3 = v.emplace<4>(3u, 'a');
     static_assert(std::is_same_v<std::string&, decltype(ref3)>, "");
     assert(std::get<4>(v) == "aaa");
     assert(&ref3 == &std::get<4>(v));
index e0a048a..8e68823 100644 (file)
@@ -111,7 +111,7 @@ void test_basic() {
     assert(std::get<2>(v) == &x);
     assert(&ref2 == &std::get<2>(v));
     // emplace with multiple args
-    auto& ref3 = v.emplace<std::string>(3, 'a');
+    auto& ref3 = v.emplace<std::string>(3u, 'a');
     static_assert(std::is_same_v<std::string&, decltype(ref3)>, "");
     assert(std::get<4>(v) == "aaa");
     assert(&ref3 == &std::get<4>(v));