summaryrefslogtreecommitdiffstats
path: root/libcxxabi/test/catch_const_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_const_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_const_pointer_nullptr.pass.cpp')
-rw-r--r--libcxxabi/test/catch_const_pointer_nullptr.pass.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/libcxxabi/test/catch_const_pointer_nullptr.pass.cpp b/libcxxabi/test/catch_const_pointer_nullptr.pass.cpp
index 3d8f0d13a76..ccf4405a370 100644
--- a/libcxxabi/test/catch_const_pointer_nullptr.pass.cpp
+++ b/libcxxabi/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*)
{
OpenPOWER on IntegriCloud