summaryrefslogtreecommitdiffstats
path: root/libcxxabi/test/test_vector3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxxabi/test/test_vector3.cpp')
-rw-r--r--libcxxabi/test/test_vector3.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/libcxxabi/test/test_vector3.cpp b/libcxxabi/test/test_vector3.cpp
new file mode 100644
index 00000000000..8143b95c192
--- /dev/null
+++ b/libcxxabi/test/test_vector3.cpp
@@ -0,0 +1,48 @@
+#include "cxxabi.h"
+
+#include <stdio.h>
+#include <assert.h>
+#include <exception>
+
+#include <memory>
+
+// use dtors instead of try/catch
+namespace test1 {
+ struct B {
+ ~B() {
+ printf("should not be run\n");
+ exit(10);
+ }
+};
+
+struct A {
+ ~A()
+#if __has_feature(cxx_noexcept)
+ noexcept(false)
+#endif
+ {
+ B b;
+ throw 0;
+ }
+};
+} // test1
+
+void my_terminate() { exit(0); }
+
+template <class T>
+void destroy(void* v)
+{
+ T* t = static_cast<T*>(v);
+ t->~T();
+}
+
+int main( int argc, char *argv [])
+{
+ std::set_terminate(my_terminate);
+ {
+ typedef test1::A Array[10];
+ Array a[10]; // calls _cxa_vec_dtor
+ __cxxabiv1::__cxa_vec_dtor(a, 10, sizeof(test1::A), destroy<test1::A>);
+ assert(false);
+ }
+} \ No newline at end of file
OpenPOWER on IntegriCloud