[OpenACC] Enable 'attach' clause for combined constructs
[llvm-project.git] / libcxxabi / test / catch_member_data_pointer_01.pass.cpp
blob6d739e7932d63f342241bceb60fad751e14ba934
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
11 #include <cassert>
13 struct A
15 A() : i(0), j(0) {} // explicitly initialize 'i' to prevent warnings
16 const int i;
17 int j;
20 typedef const int A::*md1;
21 typedef int A::*md2;
23 struct B : public A
25 B() : k(0), l(0) {} // explicitly initialize 'k' to prevent warnings.
26 const int k;
27 int l;
30 typedef const int B::*der1;
31 typedef int B::*der2;
33 void test1()
35 try
37 throw &A::i;
38 assert(false);
40 catch (md2)
42 assert(false);
44 catch (md1)
49 // Check that cv qualified conversions are allowed.
50 void test2()
52 try
54 throw &A::j;
56 catch (md2)
59 catch (...)
61 assert(false);
64 try
66 throw &A::j;
67 assert(false);
69 catch (md1)
72 catch (...)
74 assert(false);
78 // Check that Base -> Derived conversions are NOT allowed.
79 void test3()
81 try
83 throw &A::i;
84 assert(false);
86 catch (md2)
88 assert(false);
90 catch (der2)
92 assert(false);
94 catch (der1)
96 assert(false);
98 catch (md1)
103 // Check that Base -> Derived conversions NOT are allowed with different cv
104 // qualifiers.
105 void test4()
109 throw &A::j;
110 assert(false);
112 catch (der2)
114 assert(false);
116 catch (der1)
118 assert(false);
120 catch (md2)
123 catch (...)
125 assert(false);
129 // Check that no Derived -> Base conversions are allowed.
130 void test5()
134 throw &B::k;
135 assert(false);
137 catch (md1)
139 assert(false);
141 catch (md2)
143 assert(false);
145 catch (der1)
151 throw &B::l;
152 assert(false);
154 catch (md1)
156 assert(false);
158 catch (md2)
160 assert(false);
162 catch (der2)
167 int main(int, char**)
169 test1();
170 test2();
171 test3();
172 test4();
173 test5();
175 return 0;