diff options
author | Eric Fiselier <eric@efcs.ca> | 2015-04-02 23:26:37 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2015-04-02 23:26:37 +0000 |
commit | 1b00fc5d8133bab423fc15eb9ce0e930fa0fc709 (patch) | |
tree | f4ce7d87c402556d744d90d0673c0b5a150d5e98 /libcxxabi/test/catch_pointer_nullptr.pass.cpp | |
parent | 696f275954488b7291faf8058a62c62992c33885 (diff) | |
download | bcm5719-llvm-1b00fc5d8133bab423fc15eb9ce0e930fa0fc709.tar.gz bcm5719-llvm-1b00fc5d8133bab423fc15eb9ce0e930fa0fc709.zip |
[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
llvm-svn: 233984
Diffstat (limited to 'libcxxabi/test/catch_pointer_nullptr.pass.cpp')
-rw-r--r-- | libcxxabi/test/catch_pointer_nullptr.pass.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/libcxxabi/test/catch_pointer_nullptr.pass.cpp b/libcxxabi/test/catch_pointer_nullptr.pass.cpp index dae6e6aa781..b969119b0d8 100644 --- a/libcxxabi/test/catch_pointer_nullptr.pass.cpp +++ b/libcxxabi/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 @@ void test1() } } -struct A {}; - void test2() { try @@ -45,6 +50,18 @@ void test2() } } +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 @@ void test2() { } +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::**>(); } |