diff options
| author | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
| commit | 5a83710e371fe68a06e6e3876c6a2c8b820a8976 (patch) | |
| tree | afde4c82ad6704681781c5cd49baa3fbd05c85db /libcxx/test/language.support/support.exception | |
| parent | f11e8eab527fba316c64112f6e05de1a79693a3e (diff) | |
| download | bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.tar.gz bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.zip | |
Move test into test/std subdirectory.
llvm-svn: 224658
Diffstat (limited to 'libcxx/test/language.support/support.exception')
19 files changed, 0 insertions, 1064 deletions
diff --git a/libcxx/test/language.support/support.exception/bad.exception/bad_exception.pass.cpp b/libcxx/test/language.support/support.exception/bad.exception/bad_exception.pass.cpp deleted file mode 100644 index 3baddaa898d..00000000000 --- a/libcxx/test/language.support/support.exception/bad.exception/bad_exception.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// test bad_exception - -#include <exception> -#include <type_traits> -#include <cassert> - -int main() -{ - static_assert((std::is_base_of<std::exception, std::bad_exception>::value), - "std::is_base_of<std::exception, std::bad_exception>::value"); - static_assert(std::is_polymorphic<std::bad_exception>::value, - "std::is_polymorphic<std::bad_exception>::value"); - std::bad_exception b; - std::bad_exception b2 = b; - b2 = b; - const char* w = b2.what(); - assert(w); -} diff --git a/libcxx/test/language.support/support.exception/except.nested/assign.pass.cpp b/libcxx/test/language.support/support.exception/except.nested/assign.pass.cpp deleted file mode 100644 index cbe303c570d..00000000000 --- a/libcxx/test/language.support/support.exception/except.nested/assign.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -// class nested_exception; - -// nested_exception& operator=(const nested_exception&) throw() = default; - -#include <exception> -#include <cassert> - -class A -{ - int data_; -public: - explicit A(int data) : data_(data) {} - - friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;} -}; - -int main() -{ - { - std::nested_exception e0; - std::nested_exception e; - e = e0; - assert(e.nested_ptr() == nullptr); - } - { - try - { - throw A(2); - assert(false); - } - catch (const A&) - { - std::nested_exception e0; - std::nested_exception e; - e = e0; - assert(e.nested_ptr() != nullptr); - try - { - rethrow_exception(e.nested_ptr()); - assert(false); - } - catch (const A& a) - { - assert(a == A(2)); - } - } - } -} diff --git a/libcxx/test/language.support/support.exception/except.nested/ctor_copy.pass.cpp b/libcxx/test/language.support/support.exception/except.nested/ctor_copy.pass.cpp deleted file mode 100644 index bfa13707a97..00000000000 --- a/libcxx/test/language.support/support.exception/except.nested/ctor_copy.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -// class nested_exception; - -// nested_exception(const nested_exception&) throw() = default; - -#include <exception> -#include <cassert> - -class A -{ - int data_; -public: - explicit A(int data) : data_(data) {} - - friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;} -}; - -int main() -{ - { - std::nested_exception e0; - std::nested_exception e = e0; - assert(e.nested_ptr() == nullptr); - } - { - try - { - throw A(2); - assert(false); - } - catch (const A&) - { - std::nested_exception e0; - std::nested_exception e = e0; - assert(e.nested_ptr() != nullptr); - try - { - rethrow_exception(e.nested_ptr()); - assert(false); - } - catch (const A& a) - { - assert(a == A(2)); - } - } - } -} diff --git a/libcxx/test/language.support/support.exception/except.nested/ctor_default.pass.cpp b/libcxx/test/language.support/support.exception/except.nested/ctor_default.pass.cpp deleted file mode 100644 index 1422f770eca..00000000000 --- a/libcxx/test/language.support/support.exception/except.nested/ctor_default.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -// class nested_exception; - -// nested_exception() throw(); - -#include <exception> -#include <cassert> - -class A -{ - int data_; -public: - explicit A(int data) : data_(data) {} - - friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;} -}; - -int main() -{ - { - std::nested_exception e; - assert(e.nested_ptr() == nullptr); - } - { - try - { - throw A(2); - assert(false); - } - catch (const A&) - { - std::nested_exception e; - assert(e.nested_ptr() != nullptr); - try - { - rethrow_exception(e.nested_ptr()); - assert(false); - } - catch (const A& a) - { - assert(a == A(2)); - } - } - } -} diff --git a/libcxx/test/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp b/libcxx/test/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp deleted file mode 100644 index 567ed579eb7..00000000000 --- a/libcxx/test/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp +++ /dev/null @@ -1,89 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -// class nested_exception; - -// template <class E> void rethrow_if_nested(const E& e); - -#include <exception> -#include <cstdlib> -#include <cassert> - -class A -{ - int data_; -public: - explicit A(int data) : data_(data) {} - virtual ~A() _NOEXCEPT {} - - friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;} -}; - -class B - : public std::nested_exception, - public A -{ -public: - explicit B(int data) : A(data) {} - B(const B& b) : A(b) {} -}; - -int main() -{ - { - try - { - A a(3); - std::rethrow_if_nested(a); - assert(true); - } - catch (...) - { - assert(false); - } - } - { - try - { - throw B(5); - } - catch (const B& b) - { - try - { - throw b; - } - catch (const A& a) - { - try - { - std::rethrow_if_nested(a); - assert(false); - } - catch (const B& b) - { - assert(b == B(5)); - } - } - } - } - { - try - { - std::rethrow_if_nested(1); - assert(true); - } - catch (...) - { - assert(false); - } - } -} diff --git a/libcxx/test/language.support/support.exception/except.nested/rethrow_nested.pass.cpp b/libcxx/test/language.support/support.exception/except.nested/rethrow_nested.pass.cpp deleted file mode 100644 index b07269061b4..00000000000 --- a/libcxx/test/language.support/support.exception/except.nested/rethrow_nested.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -// class nested_exception; - -// void rethrow_nested [[noreturn]] () const; - -#include <exception> -#include <cstdlib> -#include <cassert> - -class A -{ - int data_; -public: - explicit A(int data) : data_(data) {} - - friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;} -}; - -void go_quietly() -{ - std::exit(0); -} - -int main() -{ - { - try - { - throw A(2); - assert(false); - } - catch (const A&) - { - const std::nested_exception e; - assert(e.nested_ptr() != nullptr); - try - { - e.rethrow_nested(); - assert(false); - } - catch (const A& a) - { - assert(a == A(2)); - } - } - } - { - try - { - std::set_terminate(go_quietly); - const std::nested_exception e; - e.rethrow_nested(); - assert(false); - } - catch (...) - { - assert(false); - } - } -} diff --git a/libcxx/test/language.support/support.exception/except.nested/throw_with_nested.pass.cpp b/libcxx/test/language.support/support.exception/except.nested/throw_with_nested.pass.cpp deleted file mode 100644 index 887264a5c6f..00000000000 --- a/libcxx/test/language.support/support.exception/except.nested/throw_with_nested.pass.cpp +++ /dev/null @@ -1,103 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -// class nested_exception; - -// template<class T> void throw_with_nested [[noreturn]] (T&& t); - -#include <exception> -#include <cstdlib> -#include <cassert> - -class A -{ - int data_; -public: - explicit A(int data) : data_(data) {} - - friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;} -}; - -class B - : public std::nested_exception -{ - int data_; -public: - explicit B(int data) : data_(data) {} - - friend bool operator==(const B& x, const B& y) {return x.data_ == y.data_;} -}; - -int main() -{ - { - try - { - A a(3); - std::throw_with_nested(a); - assert(false); - } - catch (const A& a) - { - assert(a == A(3)); - } - } - { - try - { - A a(4); - std::throw_with_nested(a); - assert(false); - } - catch (const std::nested_exception& e) - { - assert(e.nested_ptr() == nullptr); - } - } - { - try - { - B b(5); - std::throw_with_nested(b); - assert(false); - } - catch (const B& b) - { - assert(b == B(5)); - } - } - { - try - { - B b(6); - std::throw_with_nested(b); - assert(false); - } - catch (const std::nested_exception& e) - { - assert(e.nested_ptr() == nullptr); - const B& b = dynamic_cast<const B&>(e); - assert(b == B(6)); - } - } - { - try - { - int i = 7; - std::throw_with_nested(i); - assert(false); - } - catch (int i) - { - assert(i == 7); - } - } -} diff --git a/libcxx/test/language.support/support.exception/exception.terminate/nothing_to_do.pass.cpp b/libcxx/test/language.support/support.exception/exception.terminate/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55b64..00000000000 --- a/libcxx/test/language.support/support.exception/exception.terminate/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/libcxx/test/language.support/support.exception/exception.terminate/set.terminate/get_terminate.pass.cpp b/libcxx/test/language.support/support.exception/exception.terminate/set.terminate/get_terminate.pass.cpp deleted file mode 100644 index 82ae4aaa88d..00000000000 --- a/libcxx/test/language.support/support.exception/exception.terminate/set.terminate/get_terminate.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// test get_terminate - -#include <exception> -#include <cstdlib> -#include <cassert> - -void f1() {} -void f2() {} - -int main() -{ - std::set_terminate(f1); - assert(std::get_terminate() == f1); - std::set_terminate(f2); - assert(std::get_terminate() == f2); -} diff --git a/libcxx/test/language.support/support.exception/exception.terminate/set.terminate/set_terminate.pass.cpp b/libcxx/test/language.support/support.exception/exception.terminate/set.terminate/set_terminate.pass.cpp deleted file mode 100644 index c4bff603ebb..00000000000 --- a/libcxx/test/language.support/support.exception/exception.terminate/set.terminate/set_terminate.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// test set_terminate - -#include <exception> -#include <cstdlib> -#include <cassert> - -void f1() {} -void f2() {} - -int main() -{ - std::set_terminate(f1); - assert(std::set_terminate(f2) == f1); -} diff --git a/libcxx/test/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp b/libcxx/test/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp deleted file mode 100644 index 232ce0a5a88..00000000000 --- a/libcxx/test/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// test terminate_handler - -#include <exception> - -void f() {} - -int main() -{ - std::terminate_handler p = f; -} diff --git a/libcxx/test/language.support/support.exception/exception.terminate/terminate/terminate.pass.cpp b/libcxx/test/language.support/support.exception/exception.terminate/terminate/terminate.pass.cpp deleted file mode 100644 index 3199d9b9ea9..00000000000 --- a/libcxx/test/language.support/support.exception/exception.terminate/terminate/terminate.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// test terminate - -#include <exception> -#include <cstdlib> -#include <cassert> - -void f1() -{ - std::exit(0); -} - -int main() -{ - std::set_terminate(f1); - std::terminate(); - assert(false); -} diff --git a/libcxx/test/language.support/support.exception/exception/exception.pass.cpp b/libcxx/test/language.support/support.exception/exception/exception.pass.cpp deleted file mode 100644 index ad53b6ebfe5..00000000000 --- a/libcxx/test/language.support/support.exception/exception/exception.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// test exception - -#include <exception> -#include <type_traits> -#include <cassert> - -int main() -{ - static_assert(std::is_polymorphic<std::exception>::value, - "std::is_polymorphic<std::exception>::value"); - std::exception b; - std::exception b2 = b; - b2 = b; - const char* w = b2.what(); - assert(w); -} diff --git a/libcxx/test/language.support/support.exception/propagation/current_exception.pass.cpp b/libcxx/test/language.support/support.exception/propagation/current_exception.pass.cpp deleted file mode 100644 index 9ff0d6e2ce4..00000000000 --- a/libcxx/test/language.support/support.exception/propagation/current_exception.pass.cpp +++ /dev/null @@ -1,269 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -// exception_ptr current_exception(); - -#include <exception> -#include <cassert> - -struct A -{ - static int constructed; - - A() {++constructed;} - ~A() {--constructed;} - A(const A&) {++constructed;} -}; - -int A::constructed = 0; - -int main() -{ - { - std::exception_ptr p = std::current_exception(); - assert(p == nullptr); - } - { - try - { - assert(A::constructed == 0); - throw A(); - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - } - assert(A::constructed == 0); - } - assert(A::constructed == 0); - { - std::exception_ptr p2; - try - { - assert(A::constructed == 0); - throw A(); - assert(false); - } - catch (...) - { - std::exception_ptr p = std::current_exception(); - assert(A::constructed == 1); - assert(p != nullptr); - p2 = std::current_exception(); - assert(A::constructed == 1); - assert(p == p2); - } - assert(A::constructed == 1); - } - assert(A::constructed == 0); - { - std::exception_ptr p2; - try - { - assert(A::constructed == 0); - throw A(); - assert(false); - } - catch (A& a) - { - std::exception_ptr p = std::current_exception(); - assert(A::constructed == 1); - assert(p != nullptr); - p2 = std::current_exception(); - assert(A::constructed == 1); - assert(p == p2); - } - assert(A::constructed == 1); - } - assert(A::constructed == 0); - { - std::exception_ptr p2; - try - { - assert(A::constructed == 0); - throw A(); - assert(false); - } - catch (A a) - { - std::exception_ptr p = std::current_exception(); - assert(A::constructed == 2); - assert(p != nullptr); - p2 = std::current_exception(); - assert(A::constructed == 2); - assert(p == p2); - } - assert(A::constructed == 1); - } - assert(A::constructed == 0); - { - try - { - assert(A::constructed == 0); - throw A(); - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - try - { - assert(A::constructed == 1); - throw; - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - } - assert(A::constructed == 1); - } - assert(A::constructed == 0); - } - assert(A::constructed == 0); - { - try - { - assert(A::constructed == 0); - throw A(); - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - try - { - std::exception_ptr p = std::current_exception(); - assert(A::constructed == 1); - assert(p != nullptr); - throw; - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - } - assert(A::constructed == 1); - } - assert(A::constructed == 0); - } - assert(A::constructed == 0); - { - try - { - assert(A::constructed == 0); - throw A(); - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - try - { - assert(A::constructed == 1); - throw; - assert(false); - } - catch (...) - { - std::exception_ptr p = std::current_exception(); - assert(A::constructed == 1); - assert(p != nullptr); - } - assert(A::constructed == 1); - } - assert(A::constructed == 0); - } - assert(A::constructed == 0); - { - try - { - assert(A::constructed == 0); - throw A(); - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - try - { - assert(A::constructed == 1); - throw; - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - } - std::exception_ptr p = std::current_exception(); - assert(A::constructed == 1); - assert(p != nullptr); - } - assert(A::constructed == 0); - } - assert(A::constructed == 0); - { - try - { - assert(A::constructed == 0); - throw A(); - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - try - { - assert(A::constructed == 1); - throw; - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - } - assert(A::constructed == 1); - } - std::exception_ptr p = std::current_exception(); - assert(A::constructed == 0); - assert(p == nullptr); - } - assert(A::constructed == 0); - { - std::exception_ptr p; - try - { - assert(A::constructed == 0); - throw A(); - assert(false); - } - catch (...) - { - assert(A::constructed == 1); - try - { - assert(A::constructed == 1); - throw; - assert(false); - } - catch (...) - { - p = std::current_exception(); - assert(A::constructed == 1); - } - assert(A::constructed == 1); - } - assert(A::constructed == 1); - assert(p != nullptr); - } - assert(A::constructed == 0); -} diff --git a/libcxx/test/language.support/support.exception/propagation/exception_ptr.pass.cpp b/libcxx/test/language.support/support.exception/propagation/exception_ptr.pass.cpp deleted file mode 100644 index 3aa8dcf55bb..00000000000 --- a/libcxx/test/language.support/support.exception/propagation/exception_ptr.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -// typedef unspecified exception_ptr; - -// exception_ptr shall satisfy the requirements of NullablePointer. - -#include <exception> -#include <cassert> - -int main() -{ - std::exception_ptr p; - assert(p == nullptr); - std::exception_ptr p2 = p; - assert(nullptr == p); - assert(!p); - assert(p2 == p); - p2 = p; - assert(p2 == p); - assert(p2 == nullptr); - std::exception_ptr p3 = nullptr; - assert(p3 == nullptr); - p3 = nullptr; - assert(p3 == nullptr); -} diff --git a/libcxx/test/language.support/support.exception/propagation/make_exception_ptr.pass.cpp b/libcxx/test/language.support/support.exception/propagation/make_exception_ptr.pass.cpp deleted file mode 100644 index 89c9f85d381..00000000000 --- a/libcxx/test/language.support/support.exception/propagation/make_exception_ptr.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -// template<class E> exception_ptr make_exception_ptr(E e); - -#include <exception> -#include <cassert> - -struct A -{ - static int constructed; - int data_; - - A(int data = 0) : data_(data) {++constructed;} - ~A() {--constructed;} - A(const A& a) : data_(a.data_) {++constructed;} -}; - -int A::constructed = 0; - -int main() -{ - { - std::exception_ptr p = std::make_exception_ptr(A(5)); - try - { - std::rethrow_exception(p); - assert(false); - } - catch (const A& a) - { - assert(A::constructed == 1); - assert(p != nullptr); - p = nullptr; - assert(p == nullptr); - assert(a.data_ == 5); - assert(A::constructed == 1); - } - assert(A::constructed == 0); - } -} diff --git a/libcxx/test/language.support/support.exception/propagation/rethrow_exception.pass.cpp b/libcxx/test/language.support/support.exception/propagation/rethrow_exception.pass.cpp deleted file mode 100644 index e47a5989d41..00000000000 --- a/libcxx/test/language.support/support.exception/propagation/rethrow_exception.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -// void rethrow_exception [[noreturn]] (exception_ptr p); - -#include <exception> -#include <cassert> - -struct A -{ - static int constructed; - int data_; - - A(int data = 0) : data_(data) {++constructed;} - ~A() {--constructed;} - A(const A& a) : data_(a.data_) {++constructed;} -}; - -int A::constructed = 0; - -int main() -{ - { - std::exception_ptr p; - try - { - throw A(3); - } - catch (...) - { - p = std::current_exception(); - } - try - { - std::rethrow_exception(p); - assert(false); - } - catch (const A& a) - { - assert(A::constructed == 1); - assert(p != nullptr); - p = nullptr; - assert(p == nullptr); - assert(a.data_ == 3); - assert(A::constructed == 1); - } - assert(A::constructed == 0); - } -} diff --git a/libcxx/test/language.support/support.exception/uncaught/uncaught_exception.pass.cpp b/libcxx/test/language.support/support.exception/uncaught/uncaught_exception.pass.cpp deleted file mode 100644 index 22d8d8e982a..00000000000 --- a/libcxx/test/language.support/support.exception/uncaught/uncaught_exception.pass.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// test uncaught_exception - -#include <exception> -#include <cassert> - -struct A -{ - ~A() - { - assert(std::uncaught_exception()); - } -}; - -struct B -{ - B() - { - // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#475 - assert(!std::uncaught_exception()); - } -}; - -int main() -{ - try - { - A a; - assert(!std::uncaught_exception()); - throw B(); - } - catch (...) - { - assert(!std::uncaught_exception()); - } - assert(!std::uncaught_exception()); -} diff --git a/libcxx/test/language.support/support.exception/version.pass.cpp b/libcxx/test/language.support/support.exception/version.pass.cpp deleted file mode 100644 index acdedbb31fe..00000000000 --- a/libcxx/test/language.support/support.exception/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <exception> - -#include <exception> - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} |

