blob: 4060526b44d5a022b27ad1fc761174ca8f25c61e [file] [log] [blame]
Fariborz Jahanianbd94d442010-02-19 20:58:54 +00001// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
2
3@interface Super @end
4
5@interface INTFSTANDALONE : Super
6{
7 id IVAR; // expected-note {{previous definition is here}}
8}
9
10@end
11
12@implementation INTFSTANDALONE : Super // expected-warning {{class implementation may not have super class}}
13{
Fariborz Jahanian01f1bfc2010-03-22 19:04:14 +000014 id PRIV_IVAR;
Fariborz Jahanianbd94d442010-02-19 20:58:54 +000015@protected
Fariborz Jahanian01f1bfc2010-03-22 19:04:14 +000016 id PRTCTD;
Fariborz Jahanianbd94d442010-02-19 20:58:54 +000017@private
18 id IVAR3;
19 int IVAR; // expected-error {{instance variable is already declared}}
Fariborz Jahanian01f1bfc2010-03-22 19:04:14 +000020@public
21 id IVAR4;
Fariborz Jahanianbd94d442010-02-19 20:58:54 +000022}
23@end
Fariborz Jahanian01f1bfc2010-03-22 19:04:14 +000024
25@interface Base @end
26
27@implementation Base {
28 int ivar1;
29@public
30 int ivar2;
31}
32@end
33
34id fn1(INTFSTANDALONE *b) { return b->PRIV_IVAR; } // expected-error {{instance variable 'PRIV_IVAR' is private}}
35
36id fn2(INTFSTANDALONE *b) { return b->PRTCTD; } // expected-error {{instance variable 'PRTCTD' is protected}}
37
38id fn4(INTFSTANDALONE *b) { return b->IVAR4; }
39