1 /* Test warnings for shadowing instance variables. */
2 /* Based on work by: Nicola Pero <nicola@brainstorm.co.uk>. */
4 /* { dg-do compile } */
8 @interface MySuperClass
22 @implementation MySuperClass
25 /* FIXME: I wonder if the warnings shouldn't be better generated
26 when the variable is declared, rather than used! */
32 a = _private; /* { dg-warning "hides instance variable" } */
33 a = _protected; /* { dg-warning "hides instance variable" } */
34 a = _public; /* { dg-warning "hides instance variable" } */
39 @interface MyClass : MySuperClass
42 @implementation MyClass
50 /* The private variable can be shadowed without warnings, because
51 * it's invisible, and not accessible, to the subclass! */
52 a = _private; /* Ok */
53 a = _protected; /* { dg-warning "hides instance variable" } */
54 a = _public; /* { dg-warning "hides instance variable" } */