[PATCH] D26457: Protect smart-pointer tests under no exceptions

Roger Ferrer Ibanez via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 9 09:19:49 PST 2016


rogfer01 created this revision.
rogfer01 added reviewers: EricWF, rmaprath, mclow.lists.
rogfer01 added a subscriber: cfe-commits.

Skip tests that expect an exception be thrown under no-exceptions.


https://reviews.llvm.org/D26457

Files:
  test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
  test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp


Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
===================================================================
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: libcpp-no-exceptions
 // <memory>
 
 // shared_ptr
@@ -17,6 +16,8 @@
 #include <memory>
 #include <cassert>
 
+#include "test_macros.h"
+
 struct B
 {
     static int count;
@@ -42,6 +43,7 @@
 
 int main()
 {
+#ifndef TEST_HAS_NO_EXCEPTIONS
     {
         std::weak_ptr<A> wp;
         try
@@ -54,6 +56,7 @@
         }
         assert(A::count == 0);
     }
+#endif
     {
         std::shared_ptr<A> sp0(new A);
         std::weak_ptr<A> wp(sp0);
@@ -63,6 +66,7 @@
         assert(A::count == 1);
     }
     assert(A::count == 0);
+#ifndef TEST_HAS_NO_EXCEPTIONS
     {
         std::shared_ptr<A> sp0(new A);
         std::weak_ptr<A> wp(sp0);
@@ -77,4 +81,5 @@
         }
     }
     assert(A::count == 0);
+#endif
 }
Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
===================================================================
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: libcpp-no-exceptions
 // UNSUPPORTED: sanitizer-new-delete
 
 // <memory>
@@ -63,6 +62,7 @@
         assert(p.get() == raw_ptr);
         assert(ptr.get() == 0);
     }
+#ifndef TEST_HAS_NO_EXCEPTIONS
     assert(A::count == 0);
     {
         std::unique_ptr<A> ptr(new A);
@@ -86,6 +86,7 @@
 #endif
         }
     }
+#endif
     assert(A::count == 0);
     { // LWG 2399
         fn(std::unique_ptr<int>(new int));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26457.77361.patch
Type: text/x-patch
Size: 2180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161109/923fbf5e/attachment.bin>


More information about the cfe-commits mailing list