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