1 /* Test errors for accessing @private and @protected variables. */
2 /* Based on work by: Nicola Pero <nicola@brainstorm.co.uk>. */
3 /* { dg-do compile } */
6 @interface MySuperClass
20 @implementation MySuperClass
23 _private = 12; /* Ok */
24 _protected = 12; /* Ok */
25 _public = 12; /* Ok */
30 @interface MyClass : MySuperClass
33 @implementation MyClass
36 /* Private variables simply don't exist in the subclass. */
37 _private = 12; /* { dg-error "instance variable \\'_private\\' is declared private" } */
39 _protected = 12; /* Ok */
40 _public = 12; /* Ok */
52 access = m->_private; /* { dg-warning "is @private" } */
53 access = m->_protected; /* { dg-warning "is @protected" } */
54 access = m->_public; /* Ok */