1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: libcpp-no-exceptions
12 // This test fails due to a stack overflow
13 // XFAIL: LIBCXX-WINDOWS-FIXME
17 // class nested_exception;
19 // template <class E> void rethrow_if_nested(const E& e);
25 #include "test_macros.h"
31 explicit A(int data) : data_(data) {}
32 virtual ~A() TEST_NOEXCEPT {}
34 friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;}
38 : public std::nested_exception,
42 explicit B(int data) : A(data) {}
43 B(const B& b) : A(b) {}
50 C * operator&() const { assert(false); return nullptr; } // should not be called
53 class D : private std::nested_exception {};
56 class E1 : public std::nested_exception {};
57 class E2 : public std::nested_exception {};
58 class E : public E1, public E2 {};
65 A a(3); // not a polymorphic type --> no effect
66 std::rethrow_if_nested(a);
77 D s; // inaccessible base class --> no effect
78 std::rethrow_if_nested(s);
89 E s; // ambiguous base class --> no effect
90 std::rethrow_if_nested(s);
113 std::rethrow_if_nested(a);
126 std::rethrow_if_nested(C());