[libcxxabi] Disallow Base to Derived conversions for catching pointers to members.
Summary:
I accidentally implemented the 4.11 [conv.mem] conversions for libc++abi in a recent patch. @majnemer pointed out that 5.13 [except.handle] only allows the pointer conversions in 4.10 and not those is 4.11. This patch no longer allows the following example code:
```c++
struct A {};
struct B : public A {};
int main() {
try {
throw (int A::*)0;
} catch (int B::*) {
// exception caught here.
}
}
```
Reviewers: mclow.lists, jroelofs, majnemer
Reviewed By: majnemer
Subscribers: majnemer, cfe-commits
Differential Revision: http://reviews.llvm.org/D8845
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@234254 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/catch_member_data_pointer_01.pass.cpp b/test/catch_member_data_pointer_01.pass.cpp
index 298a1c0..28bf4b5 100644
--- a/test/catch_member_data_pointer_01.pass.cpp
+++ b/test/catch_member_data_pointer_01.pass.cpp
@@ -72,7 +72,7 @@
}
}
-// Check that Base -> Derived conversions are allowed.
+// Check that Base -> Derived conversions are NOT allowed.
void test3()
{
try
@@ -90,14 +90,14 @@
}
catch (der1)
{
+ assert(false);
}
catch (md1)
{
- assert(false);
}
}
-// Check that Base -> Derived conversions are allowed with different cv
+// Check that Base -> Derived conversions NOT are allowed with different cv
// qualifiers.
void test4()
{
@@ -108,19 +108,14 @@
}
catch (der2)
{
- }
- catch (...)
- {
- assert(false);
- }
-
- try
- {
- throw &A::j;
assert(false);
}
catch (der1)
{
+ assert(false);
+ }
+ catch (md2)
+ {
}
catch (...)
{