Эх сурвалжийг харах

[libc++][test] Silence more warnings in variant tests

More cases of signed-to-unsigned conversion warnings that missed the train for d2623522.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374778 91177308-0d34-0410-b5e6-96231b3b80d8
Casey Carter 5 жил өмнө
parent
commit
4fd9329d34

+ 1 - 1
test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp

@@ -547,7 +547,7 @@ void test_copy_assignment_different_index() {
     struct {
     struct {
       constexpr Result<int> operator()() const {
       constexpr Result<int> operator()() const {
         using V = std::variant<int, TCopyAssign, unsigned>;
         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(std::in_place_type<TCopyAssign>, 42);
         v = v2;
         v = v2;
         return {v.index(), std::get<1>(v).value};
         return {v.index(), std::get<1>(v).value};

+ 1 - 1
test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp

@@ -407,7 +407,7 @@ void test_move_assignment_different_index() {
   }
   }
   {
   {
     using V = std::variant<int, MoveAssign, unsigned>;
     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);
     V v2(std::in_place_type<MoveAssign>, 42);
     MoveAssign::reset();
     MoveAssign::reset();
     V &vref = (v1 = std::move(v2));
     V &vref = (v1 = std::move(v2));

+ 1 - 1
test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp

@@ -111,7 +111,7 @@ void test_basic() {
     assert(std::get<2>(v) == &x);
     assert(std::get<2>(v) == &x);
     assert(&ref2 == &std::get<2>(v));
     assert(&ref2 == &std::get<2>(v));
     // emplace with multiple args
     // 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)>, "");
     static_assert(std::is_same_v<std::string&, decltype(ref3)>, "");
     assert(std::get<4>(v) == "aaa");
     assert(std::get<4>(v) == "aaa");
     assert(&ref3 == &std::get<4>(v));
     assert(&ref3 == &std::get<4>(v));

+ 1 - 1
test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp

@@ -111,7 +111,7 @@ void test_basic() {
     assert(std::get<2>(v) == &x);
     assert(std::get<2>(v) == &x);
     assert(&ref2 == &std::get<2>(v));
     assert(&ref2 == &std::get<2>(v));
     // emplace with multiple args
     // 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)>, "");
     static_assert(std::is_same_v<std::string&, decltype(ref3)>, "");
     assert(std::get<4>(v) == "aaa");
     assert(std::get<4>(v) == "aaa");
     assert(&ref3 == &std::get<4>(v));
     assert(&ref3 == &std::get<4>(v));