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