| 1 |
/* Test instance variable scope. */ |
| 2 |
/* Author: Dimitris Papavasiliou <[email protected]>. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
#include <objc/objc.h> |
| 5 |
|
| 6 |
#if defined(__has_attribute) && __has_attribute(objc_root_class) |
| 7 |
__attribute__((objc_root_class)) |
| 8 |
#endif |
| 9 |
@interface MyClass |
| 10 |
{ |
| 11 |
int someivar; |
| 12 |
} |
| 13 |
- (void) test; |
| 14 |
@end |
| 15 |
|
| 16 |
@implementation MyClass |
| 17 |
- (void) test |
| 18 |
{ |
| 19 |
int a; |
| 20 |
|
| 21 |
/* Make sure instance variables do have local scope when |
| 22 |
-fno-local-ivar isn't specified. */ |
| 23 |
|
| 24 |
a = self->someivar; /* No warning or error. */ |
| 25 |
a = someivar; /* No error. */ |
| 26 |
} |
| 27 |
@end |