1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s 2 3@interface MySuperClass 4{ 5@private 6 int private; 7 8@protected 9 int protected; 10 11@public 12 int public; 13} 14@end 15 16@implementation MySuperClass 17- (void) test { 18 int access; 19 MySuperClass *s = 0; 20 access = s->private; 21 access = s->protected; 22} 23@end 24 25 26@interface MyClass : MySuperClass 27@end 28 29@implementation MyClass 30- (void) test { 31 int access; 32 MySuperClass *s = 0; 33 access = s->private; // expected-error {{instance variable 'private' is private}} 34 access = s->protected; 35 MyClass *m=0; 36 access = m->private; // expected-error {{instance variable 'private' is private}} 37 access = m->protected; 38} 39@end 40 41 42@interface Deeper : MyClass 43@end 44 45@implementation Deeper 46- (void) test { 47 int access; 48 MySuperClass *s = 0; 49 access = s->private; // expected-error {{instance variable 'private' is private}} 50 access = s->protected; 51 MyClass *m=0; 52 access = m->private; // expected-error {{instance variable 'private' is private}} 53 access = m->protected; 54} 55@end 56 57@interface Unrelated 58@end 59 60@implementation Unrelated 61- (void) test { 62 int access; 63 MySuperClass *s = 0; 64 access = s->private; // expected-error {{instance variable 'private' is private}} 65 access = s->protected; // expected-error {{instance variable 'protected' is protected}} 66 MyClass *m=0; 67 access = m->private; // expected-error {{instance variable 'private' is private}} 68 access = m->protected; // expected-error {{instance variable 'protected' is protected}} 69} 70@end 71 72int main (void) 73{ 74 MySuperClass *s = 0; 75 int access; 76 access = s->private; // expected-error {{instance variable 'private' is private}} 77 access = s->protected; // expected-error {{instance variable 'protected' is protected}} 78 return 0; 79} 80 81typedef signed char BOOL; 82typedef unsigned int NSUInteger; 83typedef struct _NSZone NSZone; 84@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; 85@protocol NSObject - (BOOL)isEqual:(id)object; 86@end 87@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; 88@end 89@interface NSObject <NSObject> {} 90@end 91extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); 92@interface NSResponder : NSObject <NSCoding> {} 93@end 94@protocol NSAnimatablePropertyContainer 95- (id)animator; 96@end 97extern NSString *NSAnimationTriggerOrderIn ; 98@interface NSView : NSResponder <NSAnimatablePropertyContainer> { 99 struct __VFlags2 { 100 } 101 _vFlags2; 102} 103@end 104@class NSFontDescriptor, NSAffineTransform, NSGraphicsContext; 105@interface NSScrollView : NSView {} 106@end 107 108@class CasperMixerView; 109@interface CasperDiffScrollView : NSScrollView { 110@private 111 CasperMixerView *_comparatorView; 112 NSView *someField; 113} 114@end 115 116@implementation CasperDiffScrollView 117+ (void)initialize {} 118static void _CasperDiffScrollViewInstallMixerView(CasperDiffScrollView *scrollView) { 119 if (scrollView->someField != ((void *)0)) { 120 } 121} 122@end 123