summaryrefslogtreecommitdiffstats
path: root/libcxxabi/test/catch_member_pointer_nullptr.pass.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-07-19 20:19:37 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-07-19 20:19:37 +0000
commit2f984cab4fa7b8cf07e87965fb334e9d16e7e296 (patch)
treee28a7badc48c481abf5226ad8edfee2258604611 /libcxxabi/test/catch_member_pointer_nullptr.pass.cpp
parent57faf2d2086a428ada439d620286656b76fb2be3 (diff)
downloadbcm5719-llvm-2f984cab4fa7b8cf07e87965fb334e9d16e7e296.tar.gz
bcm5719-llvm-2f984cab4fa7b8cf07e87965fb334e9d16e7e296.zip
[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. llvm-svn: 276016
Diffstat (limited to 'libcxxabi/test/catch_member_pointer_nullptr.pass.cpp')
-rw-r--r--libcxxabi/test/catch_member_pointer_nullptr.pass.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libcxxabi/test/catch_member_pointer_nullptr.pass.cpp b/libcxxabi/test/catch_member_pointer_nullptr.pass.cpp
index fb73d97265d..01888afc4f6 100644
--- a/libcxxabi/test/catch_member_pointer_nullptr.pass.cpp
+++ b/libcxxabi/test/catch_member_pointer_nullptr.pass.cpp
@@ -29,8 +29,9 @@ void test1()
throw nullptr;
assert(false);
}
- catch (md2)
+ catch (md2 p)
{
+ assert(!p);
}
catch (md1)
{
@@ -45,8 +46,9 @@ void test2()
throw nullptr;
assert(false);
}
- catch (md1)
+ catch (md1 p)
{
+ assert(!p);
}
catch (md2)
{
OpenPOWER on IntegriCloud