36bd7d63abd38bdf93d88e1626a3eeff1f3bb810
[platform/framework/web/crosswalk.git] / src / native_client / tests / toolchain / eh_catch_many.cc
1 /*
2  * Copyright 2010 The Native Client Authors.  All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can
4  * be found in the LICENSE file.
5  */
6
7 #include "native_client/tests/toolchain/eh_helper.h"
8
9 class A {
10  public:
11   A() { next_step(4); }
12   ~A() { next_step(7); }
13 };
14
15
16 class B {
17  public:
18   B() { next_step(6); }
19   ~B() { next_step(9);}
20 };
21
22
23 class C {
24  public:
25   C() { abort(); }
26   ~C() { abort(); }
27 };
28
29
30 void inner() {
31   next_step(3);
32   A a;
33   try {
34     next_step(5);
35     throw B();
36     abort();
37   } catch(C &) {
38     abort();
39   }
40 }
41
42
43 int main() {
44   next_step(1);
45
46   try {
47     next_step(2);
48     inner();
49   } catch(...) {
50     next_step(8);
51   }
52   next_step(10);
53
54   return 55;
55 }