Fariborz Jahanian | bd94d44 | 2010-02-19 20:58:54 +0000 | [diff] [blame] | 1 | // 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 Jahanian | 01f1bfc | 2010-03-22 19:04:14 +0000 | [diff] [blame] | 14 | id PRIV_IVAR; |
Fariborz Jahanian | bd94d44 | 2010-02-19 20:58:54 +0000 | [diff] [blame] | 15 | @protected |
Fariborz Jahanian | 01f1bfc | 2010-03-22 19:04:14 +0000 | [diff] [blame] | 16 | id PRTCTD; |
Fariborz Jahanian | bd94d44 | 2010-02-19 20:58:54 +0000 | [diff] [blame] | 17 | @private |
| 18 | id IVAR3; |
| 19 | int IVAR; // expected-error {{instance variable is already declared}} |
Fariborz Jahanian | 01f1bfc | 2010-03-22 19:04:14 +0000 | [diff] [blame] | 20 | @public |
| 21 | id IVAR4; |
Fariborz Jahanian | bd94d44 | 2010-02-19 20:58:54 +0000 | [diff] [blame] | 22 | } |
| 23 | @end |
Fariborz Jahanian | 01f1bfc | 2010-03-22 19:04:14 +0000 | [diff] [blame] | 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 | |