1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class -fobjc-default-synthesize-properties %s 2// rdar: //8550657 3 4@interface NSArray @end 5 6@interface NSMutableArray : NSArray @end 7 8@interface MyClass 9{ 10 NSMutableArray * _array; 11} 12 13@property (readonly) NSMutableArray * array; 14 15@end 16 17@interface MyClass () 18 19@property (readwrite) NSMutableArray * array; 20 21@end 22 23@implementation MyClass 24 25@synthesize array=_array; 26 27@end 28 29int main(void) 30{ 31 return 0; 32} 33 34// rdar://6137845 35class TCPPObject 36{ 37public: 38 TCPPObject(const TCPPObject& inObj); 39 TCPPObject(); 40 ~TCPPObject(); 41 TCPPObject& operator=(const TCPPObject& inObj); // expected-note {{'operator=' declared here}} 42private: 43 void* fData; 44}; 45 46class Trivial 47{ 48public: 49 Trivial(const Trivial& inObj); 50 Trivial(); 51 ~Trivial(); 52private: 53 void* fData; 54}; 55 56@interface MyDocument 57{ 58@private 59 TCPPObject _cppObject; 60 TCPPObject _ncppObject; 61 Trivial _tcppObject; 62} 63@property (assign, readwrite) const TCPPObject& cppObject; 64@property (assign, readwrite, nonatomic) const TCPPObject& ncppObject; 65@property (assign, readwrite) const Trivial& tcppObject; 66@end 67 68@implementation MyDocument 69 70@synthesize cppObject = _cppObject; // expected-error {{atomic property of reference type 'const TCPPObject &' cannot have non-trivial assignment operator}} 71@synthesize ncppObject = _ncppObject; 72 73@synthesize tcppObject = _tcppObject; 74@end 75 76struct IncompleteStruct; // expected-note 2 {{forward declaration of 'IncompleteStruct'}} 77struct ConvertToIncomplete { operator IncompleteStruct&(); }; 78@interface SynthIncompleteRef 79@property (readonly, nonatomic) IncompleteStruct& x; // expected-note {{property declared here}} 80@property (readonly, nonatomic) IncompleteStruct& y; // expected-note {{property declared here}} 81@end 82 83@implementation SynthIncompleteRef // expected-error {{cannot synthesize property 'x' with incomplete type 'IncompleteStruct'}} 84@synthesize y; // expected-error {{cannot synthesize property 'y' with incomplete type 'IncompleteStruct'}} 85@end 86