annotate libcxxabi/test/catch_member_pointer_nullptr.pass.cpp @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 0572611fdcc8
children 5f17cb93ff66
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
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
9 // Catching an exception thrown as nullptr was not properly handled before
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
10 // 2f984cab4fa7, which landed in macOS 10.13
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
11 // XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.12
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
12 // XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.11
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
13 // XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.10
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
14 // XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.9
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
15
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
16 // UNSUPPORTED: no-exceptions
150
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 #include <cassert>
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 #if __has_feature(cxx_nullptr)
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 struct A
anatofuz
parents:
diff changeset
23 {
anatofuz
parents:
diff changeset
24 const int i;
anatofuz
parents:
diff changeset
25 int j;
anatofuz
parents:
diff changeset
26 };
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 typedef const int A::*md1;
anatofuz
parents:
diff changeset
29 typedef int A::*md2;
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 void test1()
anatofuz
parents:
diff changeset
32 {
anatofuz
parents:
diff changeset
33 try
anatofuz
parents:
diff changeset
34 {
anatofuz
parents:
diff changeset
35 throw nullptr;
anatofuz
parents:
diff changeset
36 assert(false);
anatofuz
parents:
diff changeset
37 }
anatofuz
parents:
diff changeset
38 catch (md2 p)
anatofuz
parents:
diff changeset
39 {
anatofuz
parents:
diff changeset
40 assert(!p);
anatofuz
parents:
diff changeset
41 }
anatofuz
parents:
diff changeset
42 catch (md1)
anatofuz
parents:
diff changeset
43 {
anatofuz
parents:
diff changeset
44 assert(false);
anatofuz
parents:
diff changeset
45 }
anatofuz
parents:
diff changeset
46 }
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 void test2()
anatofuz
parents:
diff changeset
49 {
anatofuz
parents:
diff changeset
50 try
anatofuz
parents:
diff changeset
51 {
anatofuz
parents:
diff changeset
52 throw nullptr;
anatofuz
parents:
diff changeset
53 assert(false);
anatofuz
parents:
diff changeset
54 }
anatofuz
parents:
diff changeset
55 catch (md1 p)
anatofuz
parents:
diff changeset
56 {
anatofuz
parents:
diff changeset
57 assert(!p);
anatofuz
parents:
diff changeset
58 }
anatofuz
parents:
diff changeset
59 catch (md2)
anatofuz
parents:
diff changeset
60 {
anatofuz
parents:
diff changeset
61 assert(false);
anatofuz
parents:
diff changeset
62 }
anatofuz
parents:
diff changeset
63 }
anatofuz
parents:
diff changeset
64
anatofuz
parents:
diff changeset
65 #else
anatofuz
parents:
diff changeset
66
anatofuz
parents:
diff changeset
67 void test1()
anatofuz
parents:
diff changeset
68 {
anatofuz
parents:
diff changeset
69 }
anatofuz
parents:
diff changeset
70
anatofuz
parents:
diff changeset
71 void test2()
anatofuz
parents:
diff changeset
72 {
anatofuz
parents:
diff changeset
73 }
anatofuz
parents:
diff changeset
74
anatofuz
parents:
diff changeset
75 #endif
anatofuz
parents:
diff changeset
76
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
77 int main(int, char**)
150
anatofuz
parents:
diff changeset
78 {
anatofuz
parents:
diff changeset
79 test1();
anatofuz
parents:
diff changeset
80 test2();
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
81
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
82 return 0;
150
anatofuz
parents:
diff changeset
83 }