1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
2 | |
3 | @interface Root @end |
4 | |
5 | @interface SuperClass : Root |
6 | { |
7 | int iSuper; // expected-note {{previous declaration is here}} |
8 | } |
9 | @end |
10 | |
11 | @interface SubClass : SuperClass { |
12 | int ivar; // expected-error {{duplicate member 'ivar'}} |
13 | int another_ivar; // expected-error {{duplicate member 'another_ivar'}} |
14 | int iSuper; // expected-error {{duplicate member 'iSuper'}} |
15 | } |
16 | @end |
17 | |
18 | @interface SuperClass () { |
19 | int ivar; // expected-note {{previous declaration is here}} |
20 | } |
21 | @end |
22 | |
23 | @interface Root () { |
24 | int another_ivar; // expected-note {{previous declaration is here}} |
25 | } |
26 | @end |
27 | |
28 | @implementation SubClass |
29 | -(int) method { |
30 | return self->ivar; // would be ambiguous if the duplicate ivar were allowed |
31 | } |
32 | @end |
33 | |