summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxxabi/test/catch_ptr_02.cpp3
-rw-r--r--libcxxabi/test/inherited_exception.cpp10
-rw-r--r--libcxxabi/test/test_vector1.cpp14
3 files changed, 15 insertions, 12 deletions
diff --git a/libcxxabi/test/catch_ptr_02.cpp b/libcxxabi/test/catch_ptr_02.cpp
index 9421782e0c0..34af3c80469 100644
--- a/libcxxabi/test/catch_ptr_02.cpp
+++ b/libcxxabi/test/catch_ptr_02.cpp
@@ -135,9 +135,10 @@ struct vDerived : virtual public vBase {};
void test8 ()
{
+ vDerived derived;
try
{
- throw new vDerived;
+ throw &derived;
assert(false);
}
catch (vBase *p) {
diff --git a/libcxxabi/test/inherited_exception.cpp b/libcxxabi/test/inherited_exception.cpp
index 090ae975361..7c106c1e612 100644
--- a/libcxxabi/test/inherited_exception.cpp
+++ b/libcxxabi/test/inherited_exception.cpp
@@ -56,11 +56,11 @@ void f2() {
}
void f3() {
- Child* child = new Child;
- child->b1 = 10;
- child->b2 = 11;
- child->c = 12;
- throw static_cast<Base2*>(child);
+ static Child child;
+ child.b1 = 10;
+ child.b2 = 11;
+ child.c = 12;
+ throw static_cast<Base2*>(&child);
}
int main()
diff --git a/libcxxabi/test/test_vector1.cpp b/libcxxabi/test/test_vector1.cpp
index b8bf45c50c2..6790cb5aa7d 100644
--- a/libcxxabi/test/test_vector1.cpp
+++ b/libcxxabi/test/test_vector1.cpp
@@ -11,6 +11,7 @@
#include <iostream>
#include <cstdlib>
+#include <cassert>
// Wrapper routines
void *my_alloc2 ( size_t sz ) {
@@ -206,31 +207,32 @@ int test_exception_in_constructor ( ) {
int test_exception_in_destructor ( ) {
int retVal = 0;
void *one, *two, *three;
+ one = two = three = NULL;
// Throw from within a destructor
gConstructorCounter = gDestructorCounter = 0;
gConstructorThrowTarget = -1;
gDestructorThrowTarget = 15;
try {
- one = two = three = NULL;
+ one = two = NULL;
one = __cxxabiv1::__cxa_vec_new ( 10, 40, 8, throw_construct, throw_destruct );
two = __cxxabiv1::__cxa_vec_new2( 10, 40, 8, throw_construct, throw_destruct, my_alloc2, my_dealloc2 );
- three = __cxxabiv1::__cxa_vec_new3( 10, 40, 8, throw_construct, throw_destruct, my_alloc2, my_dealloc3 );
}
catch ( int i ) {}
try {
__cxxabiv1::__cxa_vec_delete ( one, 40, 8, throw_destruct );
__cxxabiv1::__cxa_vec_delete2( two, 40, 8, throw_destruct, my_dealloc2 );
- __cxxabiv1::__cxa_vec_delete3( three, 40, 8, throw_destruct, my_dealloc3 );
+ assert(false);
}
catch ( int i ) {}
// We should have thrown in the middle of cleaning up "two", which means that
-// there should be 20 calls to the destructor, and "three" was not cleaned up.
- if ( gConstructorCounter != 30 || gDestructorCounter != 20 ) {
+// there should be 20 calls to the destructor and the try block should exit
+// before the assertion.
+ if ( gConstructorCounter != 20 || gDestructorCounter != 20 ) {
std::cerr << "Unexpected Constructor/Destructor calls (1D)" << std::endl;
- std::cerr << "Expected (30, 20), but got (" << gConstructorCounter << ", " <<
+ std::cerr << "Expected (20, 20), but got (" << gConstructorCounter << ", " <<
gDestructorCounter << ")" << std::endl;
retVal = 1;
}
OpenPOWER on IntegriCloud