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