1 /* Test warnings for shadowing instance variables. */
2 /* Author: Nicola Pero <nicola@brainstorm.co.uk>. */
3 /* { dg-do compile } */
4 /* { dg-additional-options "-Wno-objc-root-class" } */
7 @interface MySuperClass
21 @implementation MySuperClass
24 /* FIXME: I wonder if the warnings shouldn't be better generated
25 when the variable is declared, rather than used! */
31 a = private; /* { dg-warning "hides instance variable" } */
32 a = protected; /* { dg-warning "hides instance variable" } */
33 a = public; /* { dg-warning "hides instance variable" } */
38 @interface MyClass : MySuperClass
41 @implementation MyClass
49 /* The private variable can be shadowed without warnings, because
50 * it's invisible, and not accessible, to the subclass! */
52 a = protected; /* { dg-warning "hides instance variable" } */
53 a = public; /* { dg-warning "hides instance variable" } */