[X86] avx512-pmovxrm.ll - replace X32 checks with X86. NFC.
[llvm-project.git] / libcxxabi / test / unwind_03.pass.cpp
blob055f807de05b99e2d3a143a26bc960083809b2f4
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-exceptions
10 // REQUIRES: c++03 || c++11 || c++14
12 #include <exception>
13 #include <stdlib.h>
14 #include <assert.h>
16 #if defined(__GNUC__)
17 #pragma GCC diagnostic ignored "-Wunreachable-code"
18 #pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated
19 #endif
21 struct A
23 static int count;
24 int id_;
25 A() : id_(++count) {}
26 ~A() {assert(id_ == count--);}
28 private:
29 A(const A&);
30 A& operator=(const A&);
33 int A::count = 0;
35 struct B
37 static int count;
38 int id_;
39 B() : id_(++count) {}
40 ~B() {assert(id_ == count--);}
42 private:
43 B(const B&);
44 B& operator=(const B&);
47 int B::count = 0;
49 struct C
51 static int count;
52 int id_;
53 C() : id_(++count) {}
54 ~C() {assert(id_ == count--);}
56 private:
57 C(const C&);
58 C& operator=(const C&);
61 int C::count = 0;
63 void f2()
65 C c;
66 A a;
67 throw 55;
68 B b;
71 void f1() throw (long, char, double)
73 A a;
74 B b;
75 f2();
76 C c;
79 void u_handler()
81 exit(0);
84 int main(int, char**)
86 std::set_unexpected(u_handler);
87 try
89 f1();
90 assert(false);
92 catch (int* i)
94 assert(false);
96 catch (long i)
98 assert(false);
100 catch (int i)
102 assert(i == 55);
104 catch (...)
106 assert(false);
108 assert(false);
110 return 0;