[X86] avx512-pmovxrm.ll - replace X32 checks with X86. NFC.
[llvm-project.git] / libcxxabi / test / unwind_02.pass.cpp
blob57ffdbd0b361921163f0c07031ebad1c44186a38
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 <assert.h>
14 #if defined(__GNUC__)
15 #pragma GCC diagnostic ignored "-Wunreachable-code"
16 #pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated
17 #endif
19 struct A
21 static int count;
22 int id_;
23 A() : id_(++count) {}
24 ~A() {assert(id_ == count--);}
26 private:
27 A(const A&);
28 A& operator=(const A&);
31 int A::count = 0;
33 struct B
35 static int count;
36 int id_;
37 B() : id_(++count) {}
38 ~B() {assert(id_ == count--);}
40 private:
41 B(const B&);
42 B& operator=(const B&);
45 int B::count = 0;
47 struct C
49 static int count;
50 int id_;
51 C() : id_(++count) {}
52 ~C() {assert(id_ == count--);}
54 private:
55 C(const C&);
56 C& operator=(const C&);
59 int C::count = 0;
61 void f2()
63 C c;
64 A a;
65 throw 55;
66 B b;
69 void f1() throw (long, char, int, double)
71 A a;
72 B b;
73 f2();
74 C c;
77 int main(int, char**)
79 try
81 f1();
82 assert(false);
84 catch (int* i)
86 assert(false);
88 catch (long i)
90 assert(false);
92 catch (int i)
94 assert(i == 55);
96 catch (...)
98 assert(false);
100 assert(A::count == 0);
101 assert(B::count == 0);
102 assert(C::count == 0);
104 return 0;