OSDN Git Service

PR testsuite/23611, PR testsuite/23615
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / obj-c++.dg / try-catch-8.mm
1 /* Test for graceful compilation of @synchronized statements.  */
2
3 /* { dg-do compile } */
4 /* { dg-options "-fobjc-exceptions" } */
5
6 #include <objc/Object.h>
7
8 @interface Derived: Object
9 - (id) meth;
10 @end
11
12 @implementation Derived
13 - (id) meth {
14   return self;
15 }
16
17 static Derived* rewriteDict(void) {
18   static Derived *sDict = 0;
19   if (sDict == 0) {
20     @synchronized ([Derived class]) {
21       if (sDict == 0)
22         sDict = [Derived new];
23     }
24   } 
25   return sDict;
26 }
27 @end