Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-04-07 02:03:01 +0300
committerEric Fiselier <eric@efcs.ca>2015-04-07 02:03:01 +0300
commitb6030b9dbf1762877795fabbea7c7b4b7dbf627e (patch)
treecbd7d45812e277dade8c9ab0e5370a3eac26c5df /libcxxabi/src/private_typeinfo.cpp
parent7c869e48210d1adcca8413ec1533dcf8ff5da56d (diff)
[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 llvm-svn: 234254
Diffstat (limited to 'libcxxabi/src/private_typeinfo.cpp')
-rw-r--r--libcxxabi/src/private_typeinfo.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/libcxxabi/src/private_typeinfo.cpp b/libcxxabi/src/private_typeinfo.cpp
index 65cb6ed35a68..590906a45b69 100644
--- a/libcxxabi/src/private_typeinfo.cpp
+++ b/libcxxabi/src/private_typeinfo.cpp
@@ -479,11 +479,9 @@ bool __pointer_to_member_type_info::can_catch(
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;
}