Fix type in the changelog entry,
[official-gcc.git] / gcc / testsuite / objc.dg / try-catch-1.m
blob387a1b6f8ba8777bce605dffe7e8c5e9154efaa5
1 /* Test if the compiler accepts @throw / @try..@catch..@finally syntax.  */
2 /* Developed by Ziemowit Laski <zlaski@apple.com>.  */
3 /* { dg-options "-fobjc-exceptions" } */
4 /* { dg-do compile } */
6 #include "../objc-obj-c++-shared/TestsuiteObject.h"
7 #include <stdio.h>
8 #include <setjmp.h>
10 @interface Frob: TestsuiteObject
11 @end
13 @implementation Frob: TestsuiteObject
14 @end
16 static int exc_control = 0;
18 int proc() {
19   if(exc_control) {
20     printf ("Throwing (%d)... ", exc_control);
21     @throw [Frob new];
22   }
23   return 1;
26 int foo()
28         @try {
29                 return proc();
30         }
31         @catch (Frob* ex) {
32                 if(exc_control > 1) {
33                   printf("Rethrowing (%d)... ", exc_control);
34                   @throw;
35                 }
36                 return 0;
37         }
38         @finally {
39                 printf("In @finally block (%d)... ", exc_control);
40         }