| 1 |
/* Test for graceful compilation of @synchronized statements. */ |
| 2 |
|
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-fobjc-exceptions" } */ |
| 5 |
|
| 6 |
#include "../objc-obj-c++-shared/TestsuiteObject.h" |
| 7 |
|
| 8 |
@interface Derived: TestsuiteObject |
| 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 |