| 1 |
/* Testing for detecting duplicate ivars. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
|
| 4 |
@interface A |
| 5 |
{ |
| 6 |
/* TODO: Have the testsuite check that these messages occur only once! */ |
| 7 |
char x; /* { dg-message "previous declaration" } */ |
| 8 |
char x; /* { dg-error "duplicate instance variable" } */ |
| 9 |
} |
| 10 |
@end |
| 11 |
|
| 12 |
/* In some versions of the compiler (eg, 4.6.x), having a subclass |
| 13 |
would generate additional, duplicate errors for the duplicate |
| 14 |
instance variable in the superclass, so adding the following would |
| 15 |
cause the error messages above to be duplicated. */ |
| 16 |
@interface B : A |
| 17 |
{ |
| 18 |
char y; |
| 19 |
} |
| 20 |
@end |