* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / nullptr35.C
blobd9321145e9a3c3d307c17a250fecfe11a45a42ca
1 // { dg-do run { target c++11 } }
3 // Test catching as pointer and pointer to member types, [except.handle] p3.
5 extern "C" void abort (void);
7 typedef decltype(nullptr) nullptr_t;
9 int result = 0;
11 void __attribute__((noinline))
12 caught(int bit)
14   result |= bit;
17 struct A { };
19 int main()
21   try {
22     try {
23       try {
24         try {
25           try {
26             throw nullptr;
27           } catch (void* p) {
28             if (p == nullptr)
29               caught(1);
30             throw;
31           }
32         } catch (void(*pf)()) {
33           if (pf == nullptr)
34             caught(2);
35           throw;
36         }
37       } catch (int A::*pm) {
38         if (pm == nullptr)
39           caught(4);
40         throw;
41       }
42     } catch (int (A::*pmf)()) {
43       if (pmf == nullptr)
44         caught(8);
45       throw;
46     }
47   } catch (nullptr_t) {
48   }
50   try {
51     try {
52       try {
53         try {
54           try {
55             throw nullptr;
56           } catch (void* const& p) {
57             if (p == nullptr)
58               caught(16);
59             throw;
60           }
61         } catch (void(* const& pf)()) {
62           if (pf == nullptr)
63             caught(32);
64           throw;
65         }
66       } catch (int A::* const& pm) {
67         if (pm == nullptr)
68           caught(64);
69         throw;
70       }
71     } catch (int (A::* const& pmf)()) {
72       if (pmf == nullptr)
73         caught(128);
74       throw;
75     }
76   } catch (nullptr_t) {
77   }
79   if (result != 255)
80     abort ();