1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -x objective-c %s.result
2// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-gc-only -x objective-c %s > %t
3// RUN: diff %t %s.result
4// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-gc-only -x objective-c++ %s > %t
5// RUN: diff %t %s.result
6// DISABLE: mingw32
7
8#include "Common.h"
9#include "GC.h"
10
11void test1(CFTypeRef *cft) {
12  id x = CFBridgingRelease(cft);
13}
14
15@interface I1
16@end
17
18@implementation I1
19-(void)dealloc {
20  // dealloc
21  test1(0);
22}
23
24@end
25
26@interface I2
27@property (strong) id prop;
28@end
29
30@implementation I2
31@synthesize prop;
32
33-(void)dealloc {
34  // finalize
35  test1(0);
36}
37@end
38
39__attribute__((objc_arc_weak_reference_unavailable))
40@interface QQ {
41  __unsafe_unretained id s;
42  __unsafe_unretained QQ *q;
43}
44@end
45
46@interface I3
47@property (unsafe_unretained) I3 * pw1, * pw2;
48@property (strong) I3 * ps;
49@property (assign) I3 * pds;
50@end
51
52@interface I4Impl {
53  I4Impl *__strong pds2;
54}
55@property (unsafe_unretained) I4Impl * pw1, * pw2;
56@property (strong) I4Impl * ps;
57@property (strong) I4Impl * pds;
58@property (strong) I4Impl * pds2;
59@end
60
61@implementation I4Impl
62@synthesize pw1, pw2, ps, pds, pds2;
63
64-(void)test1:(CFTypeRef *)cft {
65  id x = CFBridgingRelease(cft);
66}
67@end
68
69@interface I5 {
70  __unsafe_unretained id prop;
71}
72@property (unsafe_unretained, readonly)  id prop;
73@end
74