1 // Tests that the exceptions declared by the TM TS (N4514) as transaction_safe
2 // are indeed that. Thus, this also tests the transactional clones in
3 // libstdc++ and libsupc++.
5 // Not supported on Darwin nor AIX because those lack the support for
6 // weak references to undefined functions that we need in libstdc++ to make
7 // exceptions transaction-safe.
8 // { dg-do run { target { ! { *-*-darwin* powerpc-ibm-aix* } } } }
17 template<typename T> void thrower(const T& t)
28 if (ex != t) abort ();
32 template<typename T> void thrower1(const string& what)
43 if (what != ex.what()) abort ();
47 template<typename T> void thrower2(const string& what)
58 if (what != ex.what()) abort ();
65 thrower<unsigned int> (23);
67 thrower<unsigned short> (23);
69 thrower<unsigned char> (23);
71 thrower<unsigned long int> (42);
72 thrower<long int> (42);
73 thrower<unsigned long long int> (42);
74 thrower<long long int> (42);
75 thrower<double> (23.42);
76 thrower<long double> (23.42);
77 thrower<float> (23.42);
80 thrower1<exception> ("std::exception");
81 thrower1<bad_exception> ("std::bad_exception");
82 thrower2<logic_error> ("test");
83 thrower2<domain_error> ("test");
84 thrower2<invalid_argument> ("test");
85 thrower2<length_error> ("test");
86 thrower2<out_of_range> ("test");
87 thrower2<runtime_error> ("test");
88 thrower2<range_error> ("test");
89 thrower2<overflow_error> ("test");
90 thrower2<underflow_error> ("test");