diff options
author | Roger Ferrer Ibanez <roger.ferreribanez@arm.com> | 2016-12-01 17:33:36 +0000 |
---|---|---|
committer | Roger Ferrer Ibanez <roger.ferreribanez@arm.com> | 2016-12-01 17:33:36 +0000 |
commit | c9a8a5596f051c11d65bf8c61d7c2fe2d0170006 (patch) | |
tree | dd229f2b8611f0526e235f14e453305fdc22a544 /libcxx/test/std | |
parent | 9f1bcb65aa9139dfdb3b994003327503a648f7fe (diff) | |
download | bcm5719-llvm-c9a8a5596f051c11d65bf8c61d7c2fe2d0170006.tar.gz bcm5719-llvm-c9a8a5596f051c11d65bf8c61d7c2fe2d0170006.zip |
Protect optional test under libcpp-no-exceptions
Replace throw with TEST_THROW and skip tests that throw exceptions
Differential Revision: https://reviews.llvm.org/D27254
llvm-svn: 288379
Diffstat (limited to 'libcxx/test/std')
-rw-r--r-- | libcxx/test/std/experimental/optional/optional.specalg/swap.pass.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libcxx/test/std/experimental/optional/optional.specalg/swap.pass.cpp b/libcxx/test/std/experimental/optional/optional.specalg/swap.pass.cpp index d339c53c1f7..02d396758fb 100644 --- a/libcxx/test/std/experimental/optional/optional.specalg/swap.pass.cpp +++ b/libcxx/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 @@ class Z 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 @@ int main() 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 @@ int main() assert(static_cast<bool>(opt2) == true); assert(*opt2 == 2); } +#endif // TEST_HAS_NO_EXCEPTIONS } |