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