[libcxxabi] Fix multi-level pointer conversions and pointer to member conversion detection.

Summary:
Currently there are bugs in out detection of multi-level pointer conversions and pointer to member conversions. This patch fixes the following issues.

* Allow multi-level pointers with different nested qualifiers.
* Allow multi-level mixed pointers to objects and pointers to members with different nested qualifiers.
* Allow conversions from `int Base::*` to `int Derived::*` but only for non-nested pointers.

There is still some work that needs to be done to clean this patch up but I want to get some input on it.
Open questions:

* Does `__pointer_to_member_type_info::can_catch(...)` need to adjust the pointer if a base to derived conversion is performed?


Reviewers: danalbert, compnerd, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8758

git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@233984 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/catch_pointer_nullptr.pass.cpp b/test/catch_pointer_nullptr.pass.cpp
index dae6e6a..b969119 100644
--- a/test/catch_pointer_nullptr.pass.cpp
+++ b/test/catch_pointer_nullptr.pass.cpp
@@ -8,6 +8,13 @@
 //===----------------------------------------------------------------------===//
 
 #include <cassert>
+#include <cstdlib>
+
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif
+
+struct A {};
 
 #if __has_feature(cxx_nullptr)
 
@@ -27,8 +34,6 @@
     }
 }
 
-struct A {};
-
 void test2()
 {
     try
@@ -45,6 +50,18 @@
     }
 }
 
+template <class Catch>
+void catch_nullptr_test() {
+  try {
+    throw nullptr;
+    assert(false);
+  } catch (Catch) {
+    // nothing todo
+  } catch (...) {
+    assert(false);
+  }
+}
+
 #else
 
 void test1()
@@ -55,10 +72,22 @@
 {
 }
 
+template <class Catch>
+void catch_nullptr_test()
+{
+}
+
 #endif
 
 int main()
 {
-    test1();
-    test2();
+  // catch naked nullptrs
+  test1();
+  test2();
+
+  catch_nullptr_test<int*>();
+  catch_nullptr_test<int**>();
+  catch_nullptr_test<int A::*>();
+  catch_nullptr_test<const int A::*>();
+  catch_nullptr_test<int A::**>();
 }