| 1 |
/* Contributed by Nicola Pero <[email protected]>, October 2010. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
|
| 4 |
/* Test that deprecation warnings are produced when a setter/getter of |
| 5 |
a @property is used directly. */ |
| 6 |
|
| 7 |
#include <objc/objc.h> |
| 8 |
|
| 9 |
@interface MyClass |
| 10 |
{ |
| 11 |
Class isa; |
| 12 |
int variable; |
| 13 |
} |
| 14 |
@property (assign, nonatomic) int property __attribute__ ((deprecated)); |
| 15 |
@end |
| 16 |
|
| 17 |
void foo (void) |
| 18 |
{ |
| 19 |
MyClass *object = nil; |
| 20 |
|
| 21 |
if ([object property] > 0) /* { dg-warning "is deprecated" } */ |
| 22 |
{ |
| 23 |
[object setProperty: 43]; /* { dg-warning "is deprecated" } */ |
| 24 |
} |
| 25 |
} |