diff options
author | Eric Fiselier <eric@efcs.ca> | 2015-04-06 23:03:01 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2015-04-06 23:03:01 +0000 |
commit | b6030b9dbf1762877795fabbea7c7b4b7dbf627e (patch) | |
tree | cbd7d45812e277dade8c9ab0e5370a3eac26c5df /libcxxabi/test/catch_member_data_pointer_01.pass.cpp | |
parent | 7c869e48210d1adcca8413ec1533dcf8ff5da56d (diff) | |
download | bcm5719-llvm-b6030b9dbf1762877795fabbea7c7b4b7dbf627e.tar.gz bcm5719-llvm-b6030b9dbf1762877795fabbea7c7b4b7dbf627e.zip |
[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/test/catch_member_data_pointer_01.pass.cpp')
-rw-r--r-- | libcxxabi/test/catch_member_data_pointer_01.pass.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libcxxabi/test/catch_member_data_pointer_01.pass.cpp b/libcxxabi/test/catch_member_data_pointer_01.pass.cpp index 298a1c02561..28bf4b569b9 100644 --- a/libcxxabi/test/catch_member_data_pointer_01.pass.cpp +++ b/libcxxabi/test/catch_member_data_pointer_01.pass.cpp @@ -72,7 +72,7 @@ void test2() } } -// Check that Base -> Derived conversions are allowed. +// Check that Base -> Derived conversions are NOT allowed. void test3() { try @@ -90,14 +90,14 @@ void test3() } 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 @@ void test4() } catch (der2) { - } - catch (...) - { assert(false); } - - try + catch (der1) { - throw &A::j; assert(false); } - catch (der1) + catch (md2) { } catch (...) |