Fariborz Jahanian | 4088ec0 | 2010-09-09 23:01:10 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | // rdar: // 8379892 |
| 3 | |
| 4 | struct X { |
| 5 | X(); |
| 6 | X(const X&); |
| 7 | ~X(); |
John McCall | 0943168 | 2010-11-18 19:01:18 +0000 | [diff] [blame] | 8 | |
| 9 | static int staticData; |
| 10 | int data; |
| 11 | void method(); |
Fariborz Jahanian | 4088ec0 | 2010-09-09 23:01:10 +0000 | [diff] [blame] | 12 | }; |
| 13 | |
| 14 | @interface A { |
| 15 | X xval; |
| 16 | } |
| 17 | |
| 18 | - (X)x; |
| 19 | - (void)setx:(X)x; |
| 20 | @end |
| 21 | |
| 22 | void f(A* a) { |
| 23 | a.x = X(); // expected-error {{setter method is needed to assign to object using property assignment syntax}} |
| 24 | } |
| 25 | |
John McCall | 0943168 | 2010-11-18 19:01:18 +0000 | [diff] [blame] | 26 | struct Y : X { }; |
| 27 | |
| 28 | @interface B { |
| 29 | @private |
| 30 | Y *y; |
| 31 | } |
| 32 | - (Y)value; |
| 33 | - (void)setValue : (Y) arg; |
| 34 | @property Y value; |
| 35 | @end |
| 36 | |
| 37 | void g(B *b) { |
| 38 | b.value.data = 17; // expected-error {{not assignable}} |
| 39 | b.value.staticData = 17; |
| 40 | b.value.method(); |
| 41 | } |