1 //===----------------- catch_member_pointer_nullptr.cpp -------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // UNSUPPORTED: libcxxabi-no-exceptions
11 
12 #include <cassert>
13 
14 #if __has_feature(cxx_nullptr)
15 
16 struct A
17 {
18     const int i;
19     int j;
20 };
21 
22 typedef const int A::*md1;
23 typedef       int A::*md2;
24 
25 void test1()
26 {
27     try
28     {
29         throw nullptr;
30         assert(false);
31     }
32     catch (md2)
33     {
34     }
35     catch (md1)
36     {
37         assert(false);
38     }
39 }
40 
41 void test2()
42 {
43     try
44     {
45         throw nullptr;
46         assert(false);
47     }
48     catch (md1)
49     {
50     }
51     catch (md2)
52     {
53         assert(false);
54     }
55 }
56 
57 #else
58 
59 void test1()
60 {
61 }
62 
63 void test2()
64 {
65 }
66 
67 #endif
68 
69 int main()
70 {
71     test1();
72     test2();
73 }
74