diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-07-19 20:19:37 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-07-19 20:19:37 +0000 |
commit | 081ea86d80df60bcbb5517868ec5f1afab6bf973 (patch) | |
tree | 09943f2017e8e7b3457914f3541c4e81b1bddee9 /test/catch_const_pointer_nullptr.pass.cpp | |
parent | e8b3ec33ccb6f76caea7388317d5620b9c36de51 (diff) |
[libcxxabi] When catching an exception of type nullptr_t with a handler of
pointer-to-member type, produce a null value of the right type.
This fixes a bug where throwing an exception of type nullptr_t and catching it
as a pointer-to-member would not guarantee to produce a null value in the catch
handler. The fix is pretty simple: we statically allocate a constant null
pointer-to-data-member representation and a constant null
pointer-to-member-function representation, and produce the address of the
relevant value as the adjusted pointer for the exception.
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@276016 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/catch_const_pointer_nullptr.pass.cpp')
-rw-r--r-- | test/catch_const_pointer_nullptr.pass.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/test/catch_const_pointer_nullptr.pass.cpp b/test/catch_const_pointer_nullptr.pass.cpp index 3d8f0d1..ccf4405 100644 --- a/test/catch_const_pointer_nullptr.pass.cpp +++ b/test/catch_const_pointer_nullptr.pass.cpp @@ -29,8 +29,9 @@ void test1() throw nullptr; assert(false); } - catch (A*) + catch (A* p) { + assert(!p); } catch (const A*) { @@ -46,8 +47,9 @@ void test2() throw nullptr; assert(false); } - catch (const A*) + catch (const A* p) { + assert(!p); } catch (A*) { @@ -62,8 +64,9 @@ void test3() throw nullptr; assert(false); } - catch (const A* const) + catch (const A* const p) { + assert(!p); } catch (A*) { @@ -78,8 +81,9 @@ void test4() throw nullptr; assert(false); } - catch (A*) + catch (A* p) { + assert(!p); } catch (const A* const) { @@ -94,8 +98,9 @@ void test5() throw nullptr; assert(false); } - catch (A const*) + catch (A const* p) { + assert(!p); } catch (A*) { @@ -110,8 +115,9 @@ void test6() throw nullptr; assert(false); } - catch (A*) + catch (A* p) { + assert(!p); } catch (A const*) { |