rogfer01 created this revision. rogfer01 added reviewers: mclow.lists, EricWF, rmaprath. rogfer01 added a subscriber: cfe-commits.
Replace throw with TEST_THROW and skip tests that throw exceptions https://reviews.llvm.org/D27254 Files: test/std/experimental/optional/optional.specalg/swap.pass.cpp Index: test/std/experimental/optional/optional.specalg/swap.pass.cpp =================================================================== --- test/std/experimental/optional/optional.specalg/swap.pass.cpp +++ 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() @@ -221,6 +222,7 @@ assert(static_cast<bool>(opt2) == true); assert(*opt2 == 1); } +#ifndef TEST_HAS_NO_EXCEPTIONS { optional<Z> opt1; optional<Z> opt2; @@ -297,4 +299,5 @@ assert(static_cast<bool>(opt2) == true); assert(*opt2 == 2); } +#endif // TEST_HAS_NO_EXCEPTIONS }
Index: test/std/experimental/optional/optional.specalg/swap.pass.cpp =================================================================== --- test/std/experimental/optional/optional.specalg/swap.pass.cpp +++ 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() @@ -221,6 +222,7 @@ assert(static_cast<bool>(opt2) == true); assert(*opt2 == 1); } +#ifndef TEST_HAS_NO_EXCEPTIONS { optional<Z> opt1; optional<Z> opt2; @@ -297,4 +299,5 @@ assert(static_cast<bool>(opt2) == true); assert(*opt2 == 2); } +#endif // TEST_HAS_NO_EXCEPTIONS }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits