| 1 |
/* Test instance variable visibility. */ |
| 2 |
/* Author: Dimitris Papavasiliou <[email protected]>. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-additional-options "-fivar-visibility=private -Wno-objc-root-class" } */ |
| 5 |
#include <objc/objc.h> |
| 6 |
|
| 7 |
@interface MySuperClass |
| 8 |
{ |
| 9 |
int someivar; |
| 10 |
} |
| 11 |
@end |
| 12 |
|
| 13 |
@implementation MySuperClass |
| 14 |
@end |
| 15 |
|
| 16 |
|
| 17 |
@interface MyClass : MySuperClass |
| 18 |
@end |
| 19 |
|
| 20 |
@implementation MyClass |
| 21 |
@end |
| 22 |
|
| 23 |
@interface MyOtherClass |
| 24 |
- (void) test: (MyClass *) object; |
| 25 |
@end |
| 26 |
|
| 27 |
@implementation MyOtherClass |
| 28 |
- (void) test: (MyClass *) object |
| 29 |
{ |
| 30 |
int a; |
| 31 |
|
| 32 |
a = object->someivar; /* { dg-error "instance variable .someivar. is declared private" } */ |
| 33 |
} |
| 34 |
@end |