1 /* Test errors for accessing @private and @protected variables. */
2 /* Based on work by: Nicola Pero <nicola@brainstorm.co.uk>. */
4 /* { dg-do compile } */
8 @interface MySuperClass
22 @implementation MySuperClass
25 _private = 12; /* Ok */
26 _protected = 12; /* Ok */
27 _public = 12; /* Ok */
32 @interface MyClass : MySuperClass
35 @implementation MyClass
38 /* Private variables simply don't exist in the subclass. */
39 _private = 12; /* { dg-error "._private. was not declared in this scope" } */
41 _protected = 12; /* Ok */
42 _public = 12; /* Ok */
54 access = m->_private; /* { dg-error "is @private" } */
55 access = m->_protected; /* { dg-error "is @protected" } */
56 access = m->_public; /* Ok */