aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-8.mm
blob: 7adf2f9e3262ce55504ccea3740571a196f4fa56 (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
/* Test for graceful compilation of @synchronized statements.  */

/* { dg-do compile } */
/* { dg-options "-fobjc-exceptions" } */

#include "../objc-obj-c++-shared/TestsuiteObject.h"

@interface Derived: TestsuiteObject
- (id) meth;
@end

@implementation Derived
- (id) meth {
  return self;
}

static Derived* rewriteDict(void) {
  static Derived *sDict = 0;
  if (sDict == 0) {
    @synchronized ([Derived class]) {
      if (sDict == 0)
	sDict = [Derived new];
    }
  } 
  return sDict;
}
@end