aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc/execute/exceptions/finally-1.m
blob: 9d4c396393e5efef162921103e193877c6159354 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <objc/Object.h>

int
thrower_try_body()
{
        printf("Thrower try body\n");
        return (0);
}

int
finally_body()
{
        printf("Finally body\n");
        return (0);
}

int
thrower()
{
        @try
        {
                thrower_try_body();
                @throw [Object new];
        }
        @finally
        {
                finally_body();
        }       // <----- program aborts here.
        return 0;
}


int 
main(int ac, char *av[])
{
        @try
        {
                thrower();
        }
        @catch (id exc)
        {
                printf("Got exception of class %s\n", [[exc class] name]);
                [exc free];
        }
}