annotate libcxxabi/test/catch_member_pointer_nullptr.pass.cpp @ 173:0572611fdcc8 llvm10 llvm12

reorgnization done
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 11:55:54 +0900
parents 1d019706d866
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===----------------- catch_member_pointer_nullptr.cpp -------------------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
9 // UNSUPPORTED: no-exceptions
150
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 #include <cassert>
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 #if __has_feature(cxx_nullptr)
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 struct A
anatofuz
parents:
diff changeset
16 {
anatofuz
parents:
diff changeset
17 const int i;
anatofuz
parents:
diff changeset
18 int j;
anatofuz
parents:
diff changeset
19 };
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 typedef const int A::*md1;
anatofuz
parents:
diff changeset
22 typedef int A::*md2;
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 void test1()
anatofuz
parents:
diff changeset
25 {
anatofuz
parents:
diff changeset
26 try
anatofuz
parents:
diff changeset
27 {
anatofuz
parents:
diff changeset
28 throw nullptr;
anatofuz
parents:
diff changeset
29 assert(false);
anatofuz
parents:
diff changeset
30 }
anatofuz
parents:
diff changeset
31 catch (md2 p)
anatofuz
parents:
diff changeset
32 {
anatofuz
parents:
diff changeset
33 assert(!p);
anatofuz
parents:
diff changeset
34 }
anatofuz
parents:
diff changeset
35 catch (md1)
anatofuz
parents:
diff changeset
36 {
anatofuz
parents:
diff changeset
37 assert(false);
anatofuz
parents:
diff changeset
38 }
anatofuz
parents:
diff changeset
39 }
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 void test2()
anatofuz
parents:
diff changeset
42 {
anatofuz
parents:
diff changeset
43 try
anatofuz
parents:
diff changeset
44 {
anatofuz
parents:
diff changeset
45 throw nullptr;
anatofuz
parents:
diff changeset
46 assert(false);
anatofuz
parents:
diff changeset
47 }
anatofuz
parents:
diff changeset
48 catch (md1 p)
anatofuz
parents:
diff changeset
49 {
anatofuz
parents:
diff changeset
50 assert(!p);
anatofuz
parents:
diff changeset
51 }
anatofuz
parents:
diff changeset
52 catch (md2)
anatofuz
parents:
diff changeset
53 {
anatofuz
parents:
diff changeset
54 assert(false);
anatofuz
parents:
diff changeset
55 }
anatofuz
parents:
diff changeset
56 }
anatofuz
parents:
diff changeset
57
anatofuz
parents:
diff changeset
58 #else
anatofuz
parents:
diff changeset
59
anatofuz
parents:
diff changeset
60 void test1()
anatofuz
parents:
diff changeset
61 {
anatofuz
parents:
diff changeset
62 }
anatofuz
parents:
diff changeset
63
anatofuz
parents:
diff changeset
64 void test2()
anatofuz
parents:
diff changeset
65 {
anatofuz
parents:
diff changeset
66 }
anatofuz
parents:
diff changeset
67
anatofuz
parents:
diff changeset
68 #endif
anatofuz
parents:
diff changeset
69
anatofuz
parents:
diff changeset
70 int main()
anatofuz
parents:
diff changeset
71 {
anatofuz
parents:
diff changeset
72 test1();
anatofuz
parents:
diff changeset
73 test2();
anatofuz
parents:
diff changeset
74 }