[libcxx-commits] [libcxx] 687ccba - [libc++][NFC] Move swap_noexcept test to .compile.pass.cpp

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 6 08:04:41 PDT 2022


Author: Louis Dionne
Date: 2022-05-06T11:04:29-04:00
New Revision: 687ccba198301bd5998ea0307de23e9a662506aa

URL: https://github.com/llvm/llvm-project/commit/687ccba198301bd5998ea0307de23e9a662506aa
DIFF: https://github.com/llvm/llvm-project/commit/687ccba198301bd5998ea0307de23e9a662506aa.diff

LOG: [libc++][NFC] Move swap_noexcept test to .compile.pass.cpp

Added: 
    libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.compile.pass.cpp

Modified: 
    

Removed: 
    libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp


################################################################################
diff  --git a/libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.compile.pass.cpp
similarity index 91%
rename from libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp
rename to libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.compile.pass.cpp
index bea7339381697..830d05c7012db 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.compile.pass.cpp
@@ -55,7 +55,7 @@ struct some_alloc2
     typedef std::true_type is_always_equal;
 };
 
-int main(int, char**)
+void test()
 {
     {
         typedef std::vector<MoveOnly> C;
@@ -66,7 +66,7 @@ int main(int, char**)
         typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
         static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
     }
-#endif // _LIBCPP_VERSION
+#endif
     {
         typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
         static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
@@ -74,7 +74,7 @@ int main(int, char**)
     {
         typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
 #if TEST_STD_VER >= 14
-    //  In C++14, if POCS is set, swapping the allocator is required not to throw
+        //  In C++14, if POCS is set, swapping the allocator is required not to throw
         static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
 #else
         static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
@@ -83,10 +83,8 @@ int main(int, char**)
 #if TEST_STD_VER >= 14
     {
         typedef std::vector<MoveOnly, some_alloc2<MoveOnly>> C;
-    //  if the allocators are always equal, then the swap can be noexcept
+        // If the allocators are always equal, then the swap can be noexcept
         static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
     }
 #endif
-
-  return 0;
 }


        


More information about the libcxx-commits mailing list