Index: src/private_typeinfo.cpp =================================================================== --- src/private_typeinfo.cpp +++ src/private_typeinfo.cpp @@ -479,11 +479,9 @@ if (is_equal(__context, thrown_pointer_type->__context, false)) return true; - __dynamic_cast_info info = {__context, 0, thrown_pointer_type->__context, -1, 0}; - info.number_of_dst_type = 1; - __context->has_unambiguous_public_base(&info, adjustedPtr, public_path); - if (info.path_dst_ptr_to_static_ptr == public_path) - return true; + // [except.handle] does not allow the pointer-to-member conversions mentioned + // in [mem.conv] to take place. For this reason we don't check Derived->Base + // for Derived->Base conversions. return false; } Index: test/catch_member_data_pointer_01.pass.cpp =================================================================== --- test/catch_member_data_pointer_01.pass.cpp +++ 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,18 +108,13 @@ } catch (der2) { - } - catch (...) - { assert(false); } - - try + catch (der1) { - throw &A::j; assert(false); } - catch (der1) + catch (md2) { } catch (...) Index: test/catch_member_function_pointer_01.pass.cpp =================================================================== --- test/catch_member_function_pointer_01.pass.cpp +++ test/catch_member_function_pointer_01.pass.cpp @@ -18,6 +18,20 @@ typedef void (A::*mf1)(); typedef void (A::*mf2)() const; +struct B : public A +{ +}; + +typedef void (B::*dmf1)(); +typedef void (B::*dmf2)() const; + +template +bool can_convert(Tp) { return true; } + +template +bool can_convert(...) { return false; } + + void test1() { try @@ -50,8 +64,104 @@ } } + + +void test_derived() +{ + try + { + throw (mf1)0; + assert(false); + } + catch (dmf2) + { + assert(false); + } + catch (dmf1) + { + assert(false); + } + catch (mf1) + { + } + + try + { + throw (mf2)0; + assert(false); + } + catch (dmf1) + { + assert(false); + } + catch (dmf2) + { + assert(false); + } + catch (mf2) + { + } + + assert(!can_convert((dmf1)0)); + assert(!can_convert((dmf1)0)); + try + { + throw (dmf1)0; + assert(false); + } + catch (mf2) + { + assert(false); + } + catch (mf1) + { + assert(false); + } + catch (...) + { + } + + assert(!can_convert((dmf2)0)); + assert(!can_convert((dmf2)0)); + try + { + throw (dmf2)0; + assert(false); + } + catch (mf2) + { + assert(false); + } + catch (mf1) + { + assert(false); + } + catch (...) + { + } +} + +void test_void() +{ + assert(!can_convert(&A::foo)); + try + { + throw &A::foo; + assert(false); + } + catch (void*) + { + assert(false); + } + catch(...) + { + } +} + int main() { test1(); test2(); + test_derived(); + test_void(); } Index: test/catch_multi_level_pointer.pass.cpp =================================================================== --- test/catch_multi_level_pointer.pass.cpp +++ test/catch_multi_level_pointer.pass.cpp @@ -140,6 +140,4 @@ generate_tests()(); generate_tests()(); generate_tests()(); - generate_tests()(); - generate_tests()(); }