1 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code
2 // expected-no-diagnostics
10 @property int required;
13 @property int optional;
14 @property int optional1;
15 @property int optional_preexisting_setter_getter;
16 @property (setter = setOptional_preexisting_setter_getter: ,
17 getter = optional_preexisting_setter_getter) int optional_with_setter_getter_attr;
19 @property int required1;
21 @property int optional_to_be_defined;
22 @property (readonly, getter = optional_preexisting_setter_getter) int optional_getter_attr;
25 @interface Test : NSObject <Test> {
30 @property int required;
31 @property int optional_to_be_defined;
32 - (int) optional_preexisting_setter_getter;
33 - (void) setOptional_preexisting_setter_getter:(int)value;
37 @synthesize required = ivar;
38 @synthesize required1 = ivar1;
39 @synthesize optional_to_be_defined = ivar2;
40 - (int) optional_preexisting_setter_getter { return ivar; }
41 - (void) setOptional_preexisting_setter_getter:(int)value
45 - (void) setOptional_getter_attr:(int)value { ivar = value; }
51 Test *x = [[Test alloc] init];
52 /* 1. Test of a required property */
54 if (x.required1 != 100)
57 /* 2. Test of a synthesize optional property */
58 x.optional_to_be_defined = 123;
59 if (x.optional_to_be_defined != 123)
62 /* 3. Test of optional property with pre-sxisting defined setter/getter */
63 x.optional_preexisting_setter_getter = 200;
64 if (x.optional_preexisting_setter_getter != 200)
67 /* 4. Test of optional property with setter/getter attribute */
68 if (x.optional_with_setter_getter_attr != 200)
72 /* 5. Test of optional property with getter attribute and default setter method. */
73 x.optional_getter_attr = 1000;
74 if (x.optional_getter_attr != 1000)