| 1 |
/* Check that throwing an exception from a -forward:: works. */ |
| 2 |
/* Developed by Marcin Koziej <[email protected]>. */ |
| 3 |
|
| 4 |
#include <stdio.h> |
| 5 |
#include <stdlib.h> |
| 6 |
#include "../../../objc-obj-c++-shared/TestsuiteObject.m" |
| 7 |
|
| 8 |
static int i; |
| 9 |
|
| 10 |
__attribute__((objc_exception)) |
| 11 |
@interface Thrower : TestsuiteObject |
| 12 |
- forward: (SEL) s : (void*) a; |
| 13 |
@end |
| 14 |
|
| 15 |
@implementation Thrower |
| 16 |
- forward: (SEL) s : (void*) a |
| 17 |
{ |
| 18 |
i++; |
| 19 |
@throw [TestsuiteObject new]; |
| 20 |
return nil; |
| 21 |
} |
| 22 |
@end |
| 23 |
|
| 24 |
int |
| 25 |
main() |
| 26 |
{ |
| 27 |
id t = [Thrower new]; |
| 28 |
@try |
| 29 |
{ |
| 30 |
[t doesnotexist]; |
| 31 |
} |
| 32 |
@catch (id error) |
| 33 |
{ |
| 34 |
i++; |
| 35 |
[error free]; |
| 36 |
} |
| 37 |
|
| 38 |
if (i != 2) |
| 39 |
abort (); |
| 40 |
|
| 41 |
return 0; |
| 42 |
} |