Clang] Fix expansion of response files in -Wp after integrated-cc1 change
[llvm-project.git] / libcxxabi / test / unwind_02.pass.cpp
blobe7a8479f9b634c09e0853c639cf6e3cf529459d3
1 //===------------------------- unwind_02.cpp ------------------------------===//
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: libcxxabi-no-exceptions
10 // REQUIRES: c++98 || c++03 || c++11 || c++14
12 #include <assert.h>
14 #if defined(__GNUC__)
15 #pragma GCC diagnostic ignored "-Wunreachable-code"
16 #endif
18 struct A
20 static int count;
21 int id_;
22 A() : id_(++count) {}
23 ~A() {assert(id_ == count--);}
25 private:
26 A(const A&);
27 A& operator=(const A&);
30 int A::count = 0;
32 struct B
34 static int count;
35 int id_;
36 B() : id_(++count) {}
37 ~B() {assert(id_ == count--);}
39 private:
40 B(const B&);
41 B& operator=(const B&);
44 int B::count = 0;
46 struct C
48 static int count;
49 int id_;
50 C() : id_(++count) {}
51 ~C() {assert(id_ == count--);}
53 private:
54 C(const C&);
55 C& operator=(const C&);
58 int C::count = 0;
60 void f2()
62 C c;
63 A a;
64 throw 55;
65 B b;
68 void f1() throw (long, char, int, double)
70 A a;
71 B b;
72 f2();
73 C c;
76 int main()
78 try
80 f1();
81 assert(false);
83 catch (int* i)
85 assert(false);
87 catch (long i)
89 assert(false);
91 catch (int i)
93 assert(i == 55);
95 catch (...)
97 assert(false);
99 assert(A::count == 0);
100 assert(B::count == 0);
101 assert(C::count == 0);