1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %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 | { |
14 | id PRIV_IVAR; |
15 | @protected |
16 | id PRTCTD; |
17 | @private |
18 | id IVAR3; |
19 | int IVAR; // expected-error {{instance variable is already declared}} |
20 | @public |
21 | id IVAR4; |
22 | } |
23 | @end |
24 | |
25 | @interface Base @end |
26 | |
27 | @implementation Base { |
28 | int ivar1; |
29 | @public |
30 | int ivar2; |
31 | } |
32 | @end |
33 | |
34 | id fn1(INTFSTANDALONE *b) { return b->PRIV_IVAR; } // expected-error {{instance variable 'PRIV_IVAR' is private}} |
35 | |
36 | id fn2(INTFSTANDALONE *b) { return b->PRTCTD; } // expected-error {{instance variable 'PRTCTD' is protected}} |
37 | |
38 | id fn4(INTFSTANDALONE *b) { return b->IVAR4; } |
39 | |
40 | |