diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2014-02-06 04:47:02 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2014-02-06 04:47:02 +0000 |
| commit | d230a3d1f6df21caa8f48b4548c27e0f7a4dfbd1 (patch) | |
| tree | 5950b8ce745af1ca3d5b6c7cf80b6a1b7ba079fc /libcxxabi/test | |
| parent | bf71a34eb9e25c6080d5058a553dbcb75676ff95 (diff) | |
| download | bcm5719-llvm-d230a3d1f6df21caa8f48b4548c27e0f7a4dfbd1.tar.gz bcm5719-llvm-d230a3d1f6df21caa8f48b4548c27e0f7a4dfbd1.zip | |
Fix PR17221 - can't catch virtual base classes when throwing derived NULL pointers. Specifically, libc++abi would crash when you tried it.
llvm-svn: 200904
Diffstat (limited to 'libcxxabi/test')
| -rw-r--r-- | libcxxabi/test/catch_ptr_02.cpp | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/libcxxabi/test/catch_ptr_02.cpp b/libcxxabi/test/catch_ptr_02.cpp index e858c9f229e..9421782e0c0 100644 --- a/libcxxabi/test/catch_ptr_02.cpp +++ b/libcxxabi/test/catch_ptr_02.cpp @@ -130,17 +130,49 @@ void test7 () } -struct vA {}; -struct vC : virtual public vA {}; +struct vBase {}; +struct vDerived : virtual public vBase {}; void test8 () { try { - throw (vC*)0; + throw new vDerived; assert(false); } - catch (vA *p) { + catch (vBase *p) { + assert(p != 0); + } + catch (...) + { + assert (false); + } +} + +void test9 () +{ + try + { + throw nullptr; + assert(false); + } + catch (vBase *p) { + assert(p == 0); + } + catch (...) + { + assert (false); + } +} + +void test10 () +{ + try + { + throw (vDerived*)0; + assert(false); + } + catch (vBase *p) { assert(p == 0); } catch (...) @@ -158,4 +190,7 @@ int main() test5(); test6(); test7(); + test8(); + test9(); + test10(); } |

