Add comment for SelectionDAGBuilder::SL field.
[llvm-project.git] / libcxxabi / test / catch_const_pointer_nullptr.pass.cpp
blobb910545c909f1fc06afccae5fd989861a6287aae
1 //===--------------------- catch_const_pointer_nullptr.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: no-exceptions
11 #include <cassert>
13 // Clang emits warnings about exceptions of type 'Child' being caught by
14 // an earlier handler of type 'Base'. Congrats clang, you've just
15 // diagnosed the behavior under test.
16 #if defined(__clang__)
17 #pragma clang diagnostic ignored "-Wexceptions"
18 #endif
20 #if __has_feature(cxx_nullptr)
22 struct A {};
24 void test1()
26 try
28 throw nullptr;
29 assert(false);
31 catch (A* p)
33 assert(!p);
35 catch (const A*)
37 assert(false);
42 void test2()
44 try
46 throw nullptr;
47 assert(false);
49 catch (const A* p)
51 assert(!p);
53 catch (A*)
55 assert(false);
59 void test3()
61 try
63 throw nullptr;
64 assert(false);
66 catch (const A* const p)
68 assert(!p);
70 catch (A*)
72 assert(false);
76 void test4()
78 try
80 throw nullptr;
81 assert(false);
83 catch (A* p)
85 assert(!p);
87 catch (const A* const)
89 assert(false);
93 void test5()
95 try
97 throw nullptr;
98 assert(false);
100 catch (A const* p)
102 assert(!p);
104 catch (A*)
106 assert(false);
110 void test6()
114 throw nullptr;
115 assert(false);
117 catch (A* p)
119 assert(!p);
121 catch (A const*)
123 assert(false);
128 #else
130 void test1() {}
131 void test2() {}
132 void test3() {}
133 void test4() {}
134 void test5() {}
135 void test6() {}
137 #endif
139 int main()
141 test1();
142 test2();
143 test3();
144 test4();
145 test5();
146 test6();