[libcxx-commits] [libcxx] 861b526 - [libc++] Fix broken tuple tests

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 22 12:34:14 PDT 2020


Author: Louis Dionne
Date: 2020-05-22T15:33:47-04:00
New Revision: 861b52693373f08fd78f394a697a2250612b55e1

URL: https://github.com/llvm/llvm-project/commit/861b52693373f08fd78f394a697a2250612b55e1
DIFF: https://github.com/llvm/llvm-project/commit/861b52693373f08fd78f394a697a2250612b55e1.diff

LOG: [libc++] Fix broken tuple tests

The tests had copy-paste errors which started showing when an
unused-variable warning started being emitted after we made
the MoveOnly type constexpr (in a4b8ee64223f).

Added: 
    

Modified: 
    libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/disable_reduced_arity_initialization_extension.pass.cpp
    libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/disable_reduced_arity_initialization_extension.pass.cpp b/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/disable_reduced_arity_initialization_extension.pass.cpp
index 803d3b8d656d..e3ff48727df0 100644
--- a/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/disable_reduced_arity_initialization_extension.pass.cpp
+++ b/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/disable_reduced_arity_initialization_extension.pass.cpp
@@ -89,16 +89,16 @@ int main(int, char**)
         Tup t(E(0), E(1));
         static_assert(std::is_constructible<Tup, E, E>::value, "");
         static_assert(!test_convertible<Tup, E, E>(), "");
-        assert(std::get<0>(t) == 0);
-        assert(std::get<1>(t) == 1);
-        assert(std::get<2>(t) == MoveOnly());
+        assert(std::get<0>(t) == E(0));
+        assert(std::get<1>(t) == E(1));
+        assert(std::get<2>(t) == E());
 
         Tup t2(E(0));
         static_assert(std::is_constructible<Tup, E>::value, "");
         static_assert(!test_convertible<Tup, E>(), "");
-        assert(std::get<0>(t) == 0);
-        assert(std::get<1>(t) == E());
-        assert(std::get<2>(t) == E());
+        assert(std::get<0>(t2) == E(0));
+        assert(std::get<1>(t2) == E());
+        assert(std::get<2>(t2) == E());
     }
     // Check that SFINAE is properly applied with the default reduced arity
     // constructor extensions.

diff  --git a/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp b/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp
index 4e7341ffd48d..ea23cbdaa470 100644
--- a/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp
+++ b/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp
@@ -99,15 +99,15 @@ int main(int, char**)
 
         Tup t = {E(0), E(1)};
         static_assert(test_convertible<Tup, E, E>(), "");
-        assert(std::get<0>(t) == 0);
-        assert(std::get<1>(t) == 1);
-        assert(std::get<2>(t) == MoveOnly());
+        assert(std::get<0>(t) == E(0));
+        assert(std::get<1>(t) == E(1));
+        assert(std::get<2>(t) == E());
 
         Tup t2 = {E(0)};
         static_assert(test_convertible<Tup, E>(), "");
-        assert(std::get<0>(t) == 0);
-        assert(std::get<1>(t) == E());
-        assert(std::get<2>(t) == E());
+        assert(std::get<0>(t2) == E(0));
+        assert(std::get<1>(t2) == E());
+        assert(std::get<2>(t2) == E());
     }
     // Check that SFINAE is properly applied with the default reduced arity
     // constructor extensions.

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
index 6a06afab3131..1283c9d5d639 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
@@ -132,15 +132,15 @@ int main(int, char**)
 
         Tup t(E(0), E(1));
         static_assert(!test_convertible<Tup, E, E>(), "");
-        assert(std::get<0>(t) == 0);
-        assert(std::get<1>(t) == 1);
-        assert(std::get<2>(t) == MoveOnly());
+        assert(std::get<0>(t) == E(0));
+        assert(std::get<1>(t) == E(1));
+        assert(std::get<2>(t) == E());
 
         Tup t2(E(0));
         static_assert(!test_convertible<Tup, E>(), "");
-        assert(std::get<0>(t) == 0);
-        assert(std::get<1>(t) == E());
-        assert(std::get<2>(t) == E());
+        assert(std::get<0>(t2) == E(0));
+        assert(std::get<1>(t2) == E());
+        assert(std::get<2>(t2) == E());
     }
 #endif
 #if TEST_STD_VER > 11


        


More information about the libcxx-commits mailing list