halyavin created this revision.

Take extra copies in current_exception() into account.


https://reviews.llvm.org/D39962

Files:
  
test/std/language.support/support.exception/propagation/current_exception.pass.cpp

Index: test/std/language.support/support.exception/propagation/current_exception.pass.cpp
===================================================================
--- test/std/language.support/support.exception/propagation/current_exception.pass.cpp
+++ test/std/language.support/support.exception/propagation/current_exception.pass.cpp
@@ -7,10 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// This test needs to be rewritten for the Windows exception_ptr semantics
-// which copy the exception each time the exception_ptr is copied.
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
 // UNSUPPORTED: libcpp-no-exceptions
 // <exception>
 
@@ -51,6 +47,22 @@
     }
     assert(A::constructed == 0);
     {
+        try 
+        {
+            throw A();
+            assert(false);
+        }
+        catch(...)
+        {
+            std::exception_ptr p = std::current_exception();
+            int constructed_before = A::constructed;
+            std::exception_ptr p2 = p;
+            assert(A::constructed == constructed_before);
+            assert(p == p2);
+        }
+    }
+    assert(A::constructed == 0);
+    {
         std::exception_ptr p2;
         try
         {
@@ -61,11 +73,10 @@
         catch (...)
         {
             std::exception_ptr p = std::current_exception();
-            assert(A::constructed == 1);
+            assert(A::constructed <= 2);
             assert(p != nullptr);
             p2 = std::current_exception();
-            assert(A::constructed == 1);
-            assert(p == p2);
+            assert(A::constructed <= 3);
         }
         assert(A::constructed == 1);
     }
@@ -81,11 +92,10 @@
         catch (A&)
         {
             std::exception_ptr p = std::current_exception();
-            assert(A::constructed == 1);
+            assert(A::constructed <= 2);
             assert(p != nullptr);
             p2 = std::current_exception();
-            assert(A::constructed == 1);
-            assert(p == p2);
+            assert(A::constructed <= 3);
         }
         assert(A::constructed == 1);
     }
@@ -101,11 +111,10 @@
         catch (A)
         {
             std::exception_ptr p = std::current_exception();
-            assert(A::constructed == 2);
+            assert(A::constructed <= 3);
             assert(p != nullptr);
             p2 = std::current_exception();
-            assert(A::constructed == 2);
-            assert(p == p2);
+            assert(A::constructed <= 4);
         }
         assert(A::constructed == 1);
     }
@@ -148,7 +157,7 @@
             try
             {
                 std::exception_ptr p = std::current_exception();
-                assert(A::constructed == 1);
+                assert(A::constructed <= 2);
                 assert(p != nullptr);
                 throw;
                 assert(false);
@@ -181,7 +190,7 @@
             catch (...)
             {
                 std::exception_ptr p = std::current_exception();
-                assert(A::constructed == 1);
+                assert(A::constructed <= 2);
                 assert(p != nullptr);
             }
             assert(A::constructed == 1);
@@ -210,7 +219,7 @@
                 assert(A::constructed == 1);
             }
             std::exception_ptr p = std::current_exception();
-            assert(A::constructed == 1);
+            assert(A::constructed <= 2);
             assert(p != nullptr);
         }
         assert(A::constructed == 0);
@@ -263,9 +272,9 @@
             catch (...)
             {
                 p = std::current_exception();
-                assert(A::constructed == 1);
+                assert(A::constructed <= 2);
             }
-            assert(A::constructed == 1);
+            assert(A::constructed <= 2);
         }
         assert(A::constructed == 1);
         assert(p != nullptr);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D39962: [libcxx] ... Andrey Khalyavin via Phabricator via cfe-commits

Reply via email to