[PATCH] D27254: Protect optional test under libcpp-no-exceptions

Roger Ferrer Ibanez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 1 09:43:39 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL288379: Protect optional test under libcpp-no-exceptions (authored by rogfer01).

Changed prior to commit:
  https://reviews.llvm.org/D27254?vs=79765&id=79932#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27254

Files:
  libcxx/trunk/test/std/experimental/optional/optional.specalg/swap.pass.cpp


Index: libcxx/trunk/test/std/experimental/optional/optional.specalg/swap.pass.cpp
===================================================================
--- libcxx/trunk/test/std/experimental/optional/optional.specalg/swap.pass.cpp
+++ libcxx/trunk/test/std/experimental/optional/optional.specalg/swap.pass.cpp
@@ -8,7 +8,6 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
 // <optional>
 
 // template <class T> void swap(optional<T>& x, optional<T>& y)
@@ -18,6 +17,8 @@
 #include <type_traits>
 #include <cassert>
 
+#include "test_macros.h"
+
 using std::experimental::optional;
 
 class X
@@ -55,10 +56,10 @@
     int i_;
 public:
     Z(int i) : i_(i) {}
-    Z(Z&&) {throw 7;}
+    Z(Z&&) {TEST_THROW(7);}
 
     friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
-    friend void swap(Z& x, Z& y) {throw 6;}
+    friend void swap(Z& x, Z& y) {TEST_THROW(6);}
 };
 
 int main()
@@ -231,6 +232,7 @@
         assert(static_cast<bool>(opt1) == false);
         assert(static_cast<bool>(opt2) == false);
     }
+#ifndef TEST_HAS_NO_EXCEPTIONS
     {
         optional<Z> opt1;
         opt1.emplace(1);
@@ -297,4 +299,5 @@
         assert(static_cast<bool>(opt2) == true);
         assert(*opt2 == 2);
     }
+#endif  // TEST_HAS_NO_EXCEPTIONS
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27254.79932.patch
Type: text/x-patch
Size: 1383 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161201/2349290e/attachment.bin>


More information about the cfe-commits mailing list