OSDN Git Service

libobjc/ChangeLog:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc / execute / exceptions / finally-1.m
1 #include <objc/Object.h>
2
3 int
4 thrower_try_body()
5 {
6         printf("Thrower try body\n");
7         return (0);
8 }
9
10 int
11 finally_body()
12 {
13         printf("Finally body\n");
14         return (0);
15 }
16
17 int
18 thrower()
19 {
20         @try
21         {
22                 thrower_try_body();
23                 @throw [Object new];
24         }
25         @finally
26         {
27                 finally_body();
28         }       // <----- program aborts here.
29         return 0;
30 }
31
32
33 int 
34 main(int ac, char *av[])
35 {
36         @try
37         {
38                 thrower();
39         }
40         @catch (id exc)
41         {
42                 printf("Got exception of class %s\n", [[exc class] name]);
43                 [exc free];
44         }
45 }