blob: 8143b95c192791e51662edf9b93f9031c5f2edec [file] [log] [blame]
Marshall Clow280ddee2011-06-10 03:40:19 +00001#include "cxxabi.h"
2
3#include <stdio.h>
4#include <assert.h>
5#include <exception>
6
7#include <memory>
8
9// use dtors instead of try/catch
10namespace test1 {
11 struct B {
12 ~B() {
13 printf("should not be run\n");
14 exit(10);
15 }
16};
17
18struct A {
19 ~A()
20#if __has_feature(cxx_noexcept)
21 noexcept(false)
22#endif
23 {
24 B b;
25 throw 0;
26 }
27};
28} // test1
29
30void my_terminate() { exit(0); }
31
32template <class T>
33void destroy(void* v)
34{
35 T* t = static_cast<T*>(v);
36 t->~T();
37}
38
39int main( int argc, char *argv [])
40{
41 std::set_terminate(my_terminate);
42 {
43 typedef test1::A Array[10];
44 Array a[10]; // calls _cxa_vec_dtor
45 __cxxabiv1::__cxa_vec_dtor(a, 10, sizeof(test1::A), destroy<test1::A>);
46 assert(false);
47 }
48}